Popular Google Pages:
This article is regarding What is Literals in C++?
Last updated on: 24th November 2016.
◕ What is Literals in C++ ?
Let a simple program:
using namespace std;
int india = 29;
float tripura = 3.14;
char agartala = 'G';
bool ramnagar = true;
cout << "Agartala is the Capital of Tripura." << endl;
the value 29 is the literal of the Data Type int.
the value 3.14 is the literal of the Data Type float.
the value G is the literal of the Data Type char.
the value true is the literal of the Data Type bool. Hence we can say in C++, constant values of any Data Type are referred to as literals.
Top of the page