Why in C both bool and int are %d
This will be a short article because I had this doubt, and surprisingly, it had a simple answer. So, I’m shifting from game development to something else, and for that, I needed to learn C, C++, Rust, or Go. My dumb brain decided to pick C, and after realizing that the road ahead had a broken bridge, most people would have turned back. But nope—not me! I’m even dumber, so I kept going The Confusion: Why Does bool Use %d? Format specifiers in C are used to define how different data types should be printed. Most people treat bool and int as completely different types. So, when they discover that both bool and int use %d as their format specifier, they get confused. The fun thing is bool and integer are same things A bool can hold only two values: true or false. Internally, true is represented as 1, and false as 0. and 0 and 1 both are integer So, in reality, bool is just an int with a cool disguise. No magic, no weird compiler tricks—just a plain old integer pretending to be a Boolean. At the end of the day, when you print a bool with %d, it simply outputs 0 or 1, because that's all a Boolean is—an integer in costume!

This will be a short article because I had this doubt, and surprisingly, it had a simple answer.
So, I’m shifting from game development to something else, and for that, I needed to learn C, C++, Rust, or Go.
My dumb brain decided to pick C, and after realizing that the road ahead had a broken bridge, most people would have turned back.
But nope—not me! I’m even dumber, so I kept going
The Confusion: Why Does bool Use %d
?
Format specifiers in C are used to define how different data types should be printed.
Most people treat bool and int as completely different types. So, when they discover that both bool and int use %d as their format specifier, they get confused.
The fun thing is bool and integer are same things
A bool can hold only two values: true or false.
Internally, true is represented as 1, and false as 0.
and 0 and 1 both are integer
So, in reality, bool is just an int with a cool disguise. No magic, no weird compiler tricks—just a plain old integer pretending to be a Boolean.
At the end of the day, when you print a bool with %d, it simply outputs 0 or 1, because that's all a Boolean is—an integer in costume!