Search code examples
c++cbyteconstantsbit

Is there a constant something like bits_in_byte (8)?


Is there in C/C++ standart constant that reflects how many bits are there in one byte (8)? Something like CHAR_BIT but for byte.


Solution

  • According to the C standard, a char is one byte. Therefore CHAR_BIT is the number of bits in a byte.

    The C standard says that CHAR_BIT is "number of bits for smallest object that is not a bit-field (byte)".