Float Suffix in C++

Level 130 keystrokes

Prints the size of the float literal 3.14f in bytes, which is 4 on common platforms.

C++ code

// The f suffix makes 3.14f a float; without it, 3.14 would be a double
// sizeof gives 4 for float on common platforms (double is usually 8)
1cout << sizeof(3.14f) << endl;

Output

4
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
  • )× 1

More C++ examples at level 1

← C++ typing practice