When choosing variable types and variable names you want your intent to be as clear as possible. If you choose a bool (boolean) type, it is clear there are only two acceptable values: true or false. If you use an int (integer) type, it is no longer clear that the intent of that variable can only be 1 or 0 or whatever values you chose to mean true and false. Plus sizeof(int)sizeof(int) will typically return as being 4 bytes, while sizeof(bool)sizeof(bool) will return 1.
Dynamic
- 5.8k
- 9
- 48
- 74