Boolean
From Coderwiki
More actions
Booleans are a type of data type found in almost all major programming languages.
Possible states
edit edit sourceEach boolean variable can represent one of two values:
truefalse
Storage
edit edit sourceTheoretically, a boolean only needs to take up 1 bit in memory, as it only stores two values: true or false - or 1 or 0.
In most programming languages, however, a boolean may use more than one bit. This is because of data structure alignment and data structure padding - it's faster for the CPU to access data when it's stored in the same region.