QP School

Full Version: Storing a single character in C
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Description:

Sure! The char data type in C is used to store single characters, such as letters, digits, or symbols. It is the smallest basic data type and occupies 1 byte in memory. It can hold both positive and negative values, as well as special characters.

Example:

char ch = 'A';

Explanation:

In this example, we declare a variable ch of type char.
We initialize it with the character 'A'.
The character is enclosed in single quotes to indicate that it is a character literal.