Character (Char):
- In computer each character is assigned a unique integer value called its code or code point.
- Char is a C++ data type designed for the storage of letters.
- You can write a single character in C++ between single quotes, such as 'a' or '?' or '*',
- Compiler will generate the code value for characters
- A char takes a memory size of 1 byte
- It stores a single character.
Char Declaration (Char):
- To declare a char variable in C++, we use the char keyword
- This should be followed by the name of the variable
char name_of_variable;
Char initialization (Char):
- The value of the variable should be enclosed within single quotes.
- The variable can be initialized at the time of the declaration.
char x = 'a' ;
0 Comments