0

Why bool is of size 1 byte ...and its only 1 or 0 so how its size became 1 bytes not 1 bit..???

size of boolean value is 1 or 0 ??

24th Nov 2016, 5:05 AM
Ramakant Vishwakarma
Ramakant Vishwakarma - avatar
1 Odpowiedź
+ 2
A bool takes in real 1 bit, as you need only 2 different values. However, when you do a sizeof(bool), it returns 1, meaning 1 byte. For practical reasons, the 7 bits remaining are stuffed. you can't store a variable of size less than 1 byte.
24th Nov 2016, 5:11 AM
Anil Krishna Raj
Anil Krishna Raj - avatar