Popular Google Pages:
◕ Send your story to RiyaButu.com and get ₹ 500/- Details..
◕ Bengali Story writing competition. Details..
This article is regarding Use a Constant directly into C++ program, without declaring it?
Last updated on: 09th December 2016.
◕ What will happen if we use a Constant directly into the C++ program, without declaring it?
- When we use a Variable in C++ program, then the program declarations tell the C++ compiler about that Type of the Variable.
But we can use a Constant directly into the C++ program, without declaring it.
The example is given bellow:
#include <iostream>
using namespace std;
int main(){
cout << "India: " << 1947 << endl;
return 0;
}
The output is:
India: 1974
- In the above example we use a constant directly without declaring it.
◕ How C++ will decide what type of constant it is?
- C++ stores integer constants as int Type unless we declare it as
Long or
Unsigned.
Related article:
How to display a value in Hexadecimal form in C++?
How to display a value in Octal form in C++?
How C++ identify the base of a number?
Top of the page