What do single quotes do in C++ when used on multiple characters?

It’s a multi-character literal. 1952805748 is 0x74657374, which decomposes as

0x74 -> 't'
0x65 -> 'e'
0x73 -> 's'
0x74 -> 't'


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-defined

Leave a Comment