Home   |   About   |   Terms   |   Contact    
Read & Learn
 

Symbolic Constant in C++

C++

☯ All C++ Articles     ☯ All Articles


A new product.





Popular Google Pages:




This article is regarding Symbolic Constant & The complete list of the Symbolic Constant in C++.
Last updated on: .



◕ Let have an example of the Symbolic Constant first:

Consider a C++ program as

#include <iostream>
#include <climits>

using namespace std;
int main()
{
int simple_integer = INT_MAX;
short short_integer = SHRT_MAX;

cout << "The Size of a Normal Interger Type is : " << sizeof simple_integer << " Bytes." << endl;
cout << "The Size of a Short Interger Type is : " << sizeof short_integer << " Bytes." << endl;

cout << " The Maximum Value of a Normal Interger is : " << simple_integer << endl;
cout << " The Maximum Value of a Short Interger is : " << short_integer << endl;

return 0;
}


- The above C++ program will give us the following result:

The Size of a Normal Interger Type is : 4 Bytes.
The Size of a Short Interger Type is : 2 Bytes.
The Maximum Value of a Normal Interger is : 2147483647
The Maximum Value of a Short Interger is : 32767



In the above example INT_MAX & SHRT_MAX are called the Symbolic Constants.
Here INT_MAX shows the Maximum Value that an int Type can hold.
Similarly SHRT_MAX shows the Maximum Value that an short Type can hold.



◕ What is Symbolic Constant in C++?

- Symbolic Constant shows us the Maximum or the Minimum values that a Data Type can hold in C++. This Symbolic Constants are from the climits header file. So when we use the Symbolic Constants in our C++ program then we have to include the climits header file in our program.


List of the Symbolic Constants in C++


◕ The complete list of the Symbolic Constant with description :

CHAR_BIT
Number of Bits in a char

CHAR_MAX
Maximum char Value

CHAR_MIN
Minimum char Value

SCHAR_MAX
Maximum Signed char Value

SCHAR_MIN
Minimum Signed char Value

UCHAR_MAX
Maximum Unsigned char Value

SHRT_MAX
Maximum short Value

SHRT_MIN
Minimum short Value

USHRT_MAX
Maximum Unsigned short Value

INT_MAX
Maximum int Value

INT_MIN
Minimum int Value

UINT_MAX
Maximum Unsigned int Value

LONG_MAX
Maximum long Value

LONG_MIN
Minimum long Value

ULONG_MAX
Maximum Unsigned long Value

LLONG_MAX
Maximum long long Value

LLONG_MIN
Minimum long long Value

ULLONG_MAX
Maximum Unsigned long long Value





Popular Google Pages:



Top of the page

Amazon & Flipkart Special Products

   


Top of the page