- 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 is a string literal in C++?
A string literal or anonymous string is a type of literal in programming for the representation of a string value within the source code. More simply put, a string literal is a bit of text between double quotes. For example,
const char* var = "Hello";
In this definition of var, "Hello" is a string literal. Using const in this way means you can use var to access the string but not to change it. A C++ compiler handles it in the same way as it would handle a character array.
Advertisements