Here are different ways that booleans can be used:
If int x is 0, it's FALSE.
If int x is 5 it's not 1 but it's still TRUE.
Yet, I can say bool myBool = TRUE <---- in the above line TRUE is not an exact value (it could be 1 or 5 or anything), but now we are treating it as an exact value (1).
In C, true and false are defined as:
#define FALSE 0
#define TRUE (!(FALSE))
Or something similar. That means your view there is kinda wrong. Technically TRUE is the maximum unsigned value for the defined type. What does that mean? Well, if we have an 'int' that is defined as 4 bytes wide, the value of TRUE would be 0xFFFFFFFF. This is the reason that TRUE is not an exact value. it's value depends on the types size. For this integer it's value in decimal is (4,294,967,295) whereas if you would have defined that type to be a 'char' of 1 byte in size, it would be 0xFF or (255).
I just don't get it. So I guess my question is, what IS a boolean and how does it work?
Also, is there such thing as a boolean "value" or not?
As I explained above, not really. But the concept is a good thing to know. Despite what I posted up there about boolean values being the maximum unsigned value, in high level languages you can still do things like:
if (x == TRUE) {...}
And if 'x' is 5, it'll execute. So why? This is because the comparison being done is against FALSE (in actuality). In assembly, we'd compare 5 against 0 and check the zero flag (ZF) in the status word. If ZF isn't set, then 'x' isn't false, so we assume it's TRUE.
if_stmt:
cmp dword [x], 0
jz .end_if
;....
.end_if:
bool mybool = TRUE seems to be a variable that stores a boolean value, which is presumably a single-bit number (not counting whether it's padded or aligned to more bits under the hood).
Yet in something like this: bool myBool = (5 == 6), the end part: (5 == 6) doesn't seem to me like it's a value at all, but more of a truth statement. How is the truth statement be converted into a variable?
That's up to the compiler to decide. A lot of compilers will use the machine's word-size as the 'boolean type', but this isn't something set in stone. From the C programmer's point of view, it's a "concept" provided by the compiler, not an actual implementation.
Hope this helped...