Popular Google Pages:
◕ Send a story and get ₹ 200/- Details..
◕ Bengali Story writing competition. Details..
This article is regarding climits Header File of C++.
Last updated on: 18th November 2016.
◕ Let a simple program:
using namespace std;
int normal_int = INT_MAX;
short short_int = SHRT_MAX;
cout << "The Size of a Normal Interger Type is : " << sizeof normal_int << " Bytes." << endl;
cout << "The Size of a Short Interger Type is : " << sizeof short_int << " Bytes." << endl;
cout << " The Maximum Value of a Normal Interger is : " << normal_int << endl;
cout << " The Maximum Value of a Short Interger is : " << short_int << endl;
◕ 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:
The sizeof is an Operator in the C++. The sizeof operator tells us that the int contains 4 bytes of memory on the base system for that particular compiler. Same as it tell us that the short contains 2 bytes of memory on the base system for that particular compiler.
◕ 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.
◕ When we use the sizeof operates then we have to include the climits header file.
The climits header file contains the Symbolic Constants to represent the limits of all Types.
This values of the Symbolic Constants are different in different system. Because the different compiler manufacturer provides different climits file that reflects the values appropriate to that particular compiler.
Top of the page