bugl
bugl
HomeLearnPatternsPathsSearch
HomeLearnPatternsPathsSearch

Loading lesson path

Learn/C++/C++ Tutorial
C++•C++ Tutorial

C++ Character Data Types

Flash cards

Review the key moves

1/4
Core idea

What is the main idea behind C++ Character Data Types?

Lesson checks

Practice each idea before moving on

Short Mimo-style checks built from this lesson's code, terms, and sequence.

1Quick choice

Which statement best captures the main point of this lesson?

2Fill blank

Complete the missing token from the example code.

___ myGrade = 'B';

Character Types

The char data type is used to store a single character. The character must be surrounded by single quotes, like 'A' or 'c':

Example

char myGrade = 'B';
cout << myGrade;

Alternatively, if you are familiar with ASCII, you can use ASCII values to display certain characters:

Example

char a = 65, b = 66, c = 67;
cout << a;
cout << b;
cout << c;

Tip

A list of all ASCII values can be found in our ASCII Table Reference .

Previous

C++ Boolean Data Types

Next

C++ String Data Types