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/archive/2010/05/31/1748066.html

欢迎关注

微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍

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

原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/11338

非原创文章文中已经注明原地址,如有侵权,联系删除

关注公众号【高性能架构探索】,第一时间获取最新文章

转载文章受原作者版权保护。转载请注明原作者出处!

(0)
上一篇 2023年2月7日 上午1:09
下一篇 2023年2月7日 上午1:09

相关推荐