|
|
Short Integer / Int data Type
|
Tutorials

Cpp

|
Topic |
How is "short int" datatype used in C++?.
|
|
Explanation |
|
The "short int" data type is used for short integers. The signed range of the datatype is between -32768 to 32767 and the unsigned range is between 0 to 65535.
Example:
#include <iostream.h>
void main()
{
signed short int s = -32768;
cout << s << '\n';
cout << "Bytes used by short int is:" << sizeof(s);
}
|
Result:
-32768
Bytes used by short int is:2
In the above example, the minimum signed integer value of -"32768" is displayed, also the number of bytes used by this datatype is got using the sizeof() function.
|
| Note |
C++ is one of the most used programming languages in the world. Also known as "C with Classes".
Hope you enjoy this tutorial. Do send your feedback or suggestions on this C++ tutorial. This is a copyright content.
|
|
|
|