Does 'a' + 'b' legal in C++...?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Does 'a' + 'b' legal in C++...??

'a' and 'b' are characters...

24th Dec 2017, 7:54 AM
Nemish Garg
Nemish Garg - avatar
2 Answers
+ 8
It is perfectly legal. The ASCII values will be added and displayed if printed. Please, this is something which takes a few seconds to verify. std::cout << 'a' + 'b';
24th Dec 2017, 9:58 AM
Hatsy Rei
Hatsy Rei - avatar
+ 5
If a and b are strings, yes. Else, no.
24th Dec 2017, 8:18 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar