C++20 sections · 1024 units
Open in Course

The char Type

Storing letters

The char type stores a single character like 'A', 'z', '5', or '?'. You write character literals in single quotes: char letter = 'A';. Each char uses 1 byte (8 bits) and is stored as a small integer from -128 to 127.

The number represents the character's ASCII code. You can store digits like '0' or '9' in a char, but they are not the same as the numbers 0 or 9. The character '0' has ASCII value 48.