J
jimjim
Hello all,
I was reading the C++ FAQ and I was astonished to learn that sizeof('x') is
equal to sizeof(char) in C++, but is equal to sizeof(int) in C.
1. Why is this?
2. Can you provide a simple code fragment that can exibit the implications
of sizeof('x') being equal to sizeof(int) (I would expect it to be
sizeof(char) as in C++)?
3. Will the code break if a C application is compiled with C++ code?
TIA
I was reading the C++ FAQ and I was astonished to learn that sizeof('x') is
equal to sizeof(char) in C++, but is equal to sizeof(int) in C.
1. Why is this?
2. Can you provide a simple code fragment that can exibit the implications
of sizeof('x') being equal to sizeof(int) (I would expect it to be
sizeof(char) as in C++)?
3. Will the code break if a C application is compiled with C++ code?
TIA