C++ Character Data Types

C++ Character Data Types


Define :

C++ Character Data Types

Character Data Type is used to denoted by char keyword

     Keyword char is used for characters. Its occupies size is 1 byte.

     The char data type is used to store a single character.

     Characters in C++ are represents in  between single quotes ' '.

     Example of char:

Output : p
Printing ASCII Value
As stated above, each character is interpreted as ASCII character. It’s possible for you to get the ASCII value of any character. You simply pass the character to the int() function. This process is called type casting. Let’s demonstrate this:
Example:

Output :