Home   |   About   |   Terms   |   Contact    
Read & Learn
 

What is Literals in C++

C++

☯ All C++ Articles     ☯ All Articles


A new product.






Popular Google Pages:




This article is regarding What is Literals in C++?
Last updated on: .



What is Literals in C++ ?

Let a simple program:
#include <iostream>
using namespace std;
int india = 29;
float tripura = 3.14;
char agartala = 'G';
bool ramnagar = true;
int main()
{
cout << "Agartala is the Capital of Tripura." << endl;
return 0;
}

Here,
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.






Popular Google Pages:





Top of the page

Amazon & Flipkart Special Products

   


Top of the page