+ 5
Char datatype with cout
why output of below code is e? char c = 'abcde'; cout << c; additionally, I am confused that how one can consider 5 characters as single character being enclosed within single quote.
2 Respostas
+ 5
This isn't definitive, as I could not find any canonical reference, but it looks like what's happening is the compiler is creating a char type in memory then repeatedly writing over the top of it, so only the final character ends up written to the char variable. This is only an educated guess, however. Let me know if this ends up being confirmed.
+ 2
Peter David Carter it looks like it is doing same as you have mentioned. See it I compiler dependent things some compiler gives warning and some strict compiler will treat it as error, but at the end it is programmers mistake.