- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What are literals in C++?
A literal is any notation for representing a value within the source code. They just exist in your source code and do not have any reference a value in memory. Contrast this with identifiers, which refer to a value in memory.
There are several types of literals in C++. Some of the examples of literals are −
- "Hello" (a string)
- 3.141 (a float/double)
- true (a boolean)
- 3 (an integer)
- 'c' (a character)
Things that are not literals −
- bar = 0; (a statement)
- 3*5-4 (an expression)
- std::cin (an identifier)
Advertisements