---
title: 1.4 Character Datatype Handling – Part 1
description: "The `char` data type stores a single character value. Characters in C++ are enclosed in single quotes and are internally represented using their corresponding integer character codes. This example demonstrates how a character is stored in a `char` variable and…"
url: "https://edcret.in/docs/cpp-programming/basic-refreshers-cplusplus/1-4-character-datatype-handling-part-1/"
updated: "2026-07-28"
category: C++ Programming / Basic Refreshers
---

# 1.4 Character Datatype Handling – Part 1

The `char` data type stores a single character value. Characters in C++ are enclosed in single quotes and are internally represented using their corresponding integer character codes.

This example demonstrates how a character is stored in a `char` variable and displayed using the standard output stream.

## Source Code

```
#include <iostream>

int main()
{
    char grade = 'A';

    std::cout << "Grade: " << grade << '\n';

    return 0;
}
```

## Output

```
Grade: A
```

## Explanation

- `char grade = 'A';` declares a character variable and initializes it with the character `'A'`.
- Character literals are enclosed in single quotes (`' '`), distinguishing them from string literals, which use double quotes (`" "`).
- A `char` variable stores only one character at a time.
- Internally, the character `'A'` is stored as its corresponding character code. The output stream automatically displays it as the character rather than its numeric value.
- `std::cout << "Grade: " << grade << '\n';` prints the text followed by the character stored in the variable.
- `return 0;` terminates the program successfully.
