DEV Community

loading...

Discussion on: Boolean in C

Collapse
rinkiyakedad profile image
Arsh Sharma

I think you can use char as a Boolean. '\0' will be treated as false and all other characters as true if I'm not mistaken.

Collapse
clavinjune profile image
Clavin June Author

isn't it easier to use char false = 0;?

Collapse
rinkiyakedad profile image
Arsh Sharma

It would work as expected for most cases but I (personally) would prefer to avoid type conversion.