I'm curious about this code:
cout << 'test'; // Note the single quotes.
gives me an output of 1952805748.
1952805748
My question: Is the output an address in memory or something?
It's a multi-character literal. 1952805748 is 0x74657374, which decomposes as
0x74657374
0x74 -> 't' 0x65 -> 'e' 0x73 -> 's' 0x74 -> 't'
Edit:
C++ standard, §2.14.3/1 - Character literals (...) An ordinary character literal that contains more than one c-char is a multicharacter literal . A multicharacter literal has type int and implementation-de?ned value.
C++ standard, §2.14.3/1 - Character literals
(...) An ordinary character literal that contains more than one c-char is a multicharacter literal . A multicharacter literal has type int and implementation-de?ned value.
2.1m questions
2.1m answers
60 comments
57.0k users