Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
What's the real size of char?
I was reading Bruce Eckel's Thinking in C++, which said that
"A char is for character storage and uses a minimum of 8 bits (one byte) of storage, although it may be larger. "
This is inconsistent with another book that I read, Programming in C++ by Nell Dale et al., which states that
"Then by definition, sizeof(char) = 1
The only guarantee made by the C++ language is that:
1 = sizeof(char) <= sizeof(short) <= sizeof(int) <= sizeof(long)
sizeof(float) <= sizeof(double) <= sizeof(long double) "
Which is which?
0 · ·