3 ms·
You missed the explanation: a char is always 1 byte, because in C the definition of byte is char. The wrong assumption is 1 byte == 8 bits.
by cdavid 16y ago
You missed the explanation: a char is always 1 byte, because in C the definition of byte is char. The wrong assumption is 1 byte == 8 bits.
- c00p3r 16y agoOK, define char. If it is a type built-in C - then of course sizeof(char) = 1. And there is no reason to write such posts. The problem is people are confusing the definition and the usage, because this particular type "char" was supposed to hold a numerical representation of a symbol, which in case of a multi-byte encoding is not 1 byte anymore. So, sizeof(char) is always 1, and what they trying to say is sizeof(numeric-representation-of-a-symbol) which is not a concern of the C language.