Character constants in C are of type int, although this is not the case in C ++. From the draft C99 standard, the 6.4.4.4Character Constants section in paragraph 10 says (emphasis added):
int. , , , . , (, 'b') [...]
++ 2.14.3 1 ( ):
[...] , c- char, , char, [...] , c- char, . , c- char, , , int , .
, av int.
sizeof(main) , , , C99 6.5.3.4 sizeof operator 1 :
sizeof , , [...]
++ , gcc clang -pedantic :
: 'sizeof' [-pedantic]
sizeof(main()), sizeof , , , int . , :
long double func()
{
return 1.0 ;
}
sizeof(func()) 16.
sizeof(int) 4, .
2
sizeof size_t, printf %zu.