+ 1

Why does a bool take 8 bits of size when it only needs 1?

26th Jun 2016, 2:33 PM
Garme Kain
Garme Kain - avatar
3 Answers
+ 1
However, if you want to use 8 bools in a byte, you can simply use a mask and work with bit operators...
27th Jun 2016, 5:14 AM
Dorian
0
Because the address counts memory spaces in bytes, not bits, so the minimum size for any variable is 1 byte or 8 bits.
26th Jun 2016, 3:45 PM
Garme Kain
Garme Kain - avatar
0
The C++ standard requires every type to take at least 1 byte.
29th Jun 2016, 12:56 AM
Stefan
Stefan - avatar