Skip to main content

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.

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

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) will typically return as being 4 bytes, while sizeof(bool) will return 1.

Source Link

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