Size of Bool in C++

Level 129 keystrokes

Prints the size of the bool type in bytes, which is 1 on common platforms.

C++ code

// A bool only needs one bit, but each object must occupy at least one addressable byte
// sizeof(bool) is implementation-defined; it is 1 on common platforms
1cout << sizeof(bool) << endl;

Output

1
Practice typing this code

Practice typing this code. Results are not recorded in the rankings.

Symbols in this code

The symbols you type in this C++ code and how often they appear.

  • <× 4
  • ;× 1
  • (× 1
  • )× 1

More C++ examples at level 1

← C++ typing practice