Data types in C++ are the format of the data input by the user. For example, if a user inputs ’45’, which is an integer, then to teach the compiler that the data input by the user is an integer, we use different set of words to help the compiler differentiate between integer, letters, decimal numbers, etc.
Literals
Literals in C++ are values which remain constant throughout the code, unless made to otherwise.
- Integer Literal
Numbers without decimals (or fraction parts) are called integer literals. They can represent a positive or a negative value. Example: 15, 122, -17, -56 etc.
2. Character Literal
A character literal is a single character from the character set and is enclosed with single inverted commas ‘ ‘. Example: ‘A’, ‘e’.