char size confusion
bit, byte, c++, char
Solution
No. The sizeof char is by definition 1. But this does not mean that it occupies 32-bits/8-bits always.
$3.9.1/1- "Objects declared as characters (char) shall be large enough to store any member of the implementation’s basic character set."
There appears to be a confusion that a byte is 8-bits. The C++ Standard does not mandate this however.
Here's how byte is defined in the Standard $1.7/1
The fundamental storage unit in the C + + memory model is the byte. A byte is at least large enough to contain any member of the basic execution character set and is composed of a contiguous sequence of bits, the number of which is implementation-defined.
As is clear, a byte need not be always 8-bits.
Problem
As per I know that 1 char = 1 byte = 8 bits(32 bit system). ``` char c=0xffff0000; //wrong ``` then why `char` allow just 8 bits and also every character in a file also of 8 bit length. thanks.