How many bits are in a byte?
Although it’s common that the number of bits in a byte is 8, this is not so for every system. That’s right, a byte is not always 8 bits. A byte is one of those terms which has an interesting history and ends up meaning different things to different people. For instance, there are some computers where it is 6, 7, 8, 9, 32-bits, and so on. In C (or C++) you can tell what it is for your system by looking at limits.h (known as climits in C++) where the macro CHAR_BIT is defined. It represents the “number of bits for the smallest object that is not a bit-field”, in other words, a byte. Note that it must be at least 8 (which mean that strictly speaking, a CPU that supports a 6 bit byte has a problem with C or C++). Also note that sizeof(char) is defined as 1 by C++ and C (ditto for the sizeof unsigned char, signed char, and their const and volatile permutations). It might be helpful to show a quote from Standard C: • byte: “addressable unit of data storage large enough to hold any member of