printf("%d\n",sizeof('c'));

In C99 - 6.4.4.4 Character constants

An integer character constant is a sequence of one or more multibyte characters enclosedin single-quotes, as in 'x'.

An integer character constant has type int

The value of an integer character constant containing more than one character (e.g.,'ab'), or containing a character or escape sequence that does not map to a single-byte execution character, is implementation-defined.

 

 

ISO/IEC
14882

in ISO/IEC14882 Programming languages — C++ 

2.13.2 Character literals
A character literal is one or more characters enclosed in single quotes, as in ’x’,

An ordinary character literal that contains a single c-char has type char ..... An ordinary character literal that contains more than one c-char is a multicharacter literal. A multicharacter literal has type int and implementation-defined value

原文地址:https://www.cnblogs.com/aoaoblogs/p/1748066.html