09/01/02 19:53:32
$ cat c_sizeof.c
#include <stdio.h>
int main(void)
{
printf("sizeof(\'\\x80\') == %d\n", sizeof('\x80'));
return 0;
}
/* EOF */
$ gcc -Wall -std=c99 -o c_sizeof c_sizeof.c
$ ./c_sizeof
sizeof('\x80') == 4
$ cat cxx_sizeof.cxx
#include <iostream>
int main()
{
std::cout << "sizeof(\'\\x80\') == " << sizeof('\x80') << std::endl;
return 0;
}
// EOF
$ g++ -Wall -o cxx_sizeof cxx_sizeof.cxx
$ ./cxx_sizeof
sizeof('\x80') == 1
なぜ、C言語ではシングルクォートが、4 Bytesであり、C++では、1 Byteなのですか。