|
|
Tutorials

Cpp

|
Topic |
How is "int" datatype used in C++?.
|
|
Explanation |
|
The "int" data type is used to represent integers. The signed range of the "int"
datatype is between -2147483648 to 2147483647 and the unsigned range is between 0 to 4294967295.
Example:
#include <iostream.h>
void main()
{
unsigned int n = 0;
cout << "Signed integer value is:"<< n << '\n';
cout << "Bytes used by int is:" << sizeof(n);
}
|
Result:
Signed integer value is:0
Bytes used by int is:4
In the above example the "0" is also an unsigned integer value, the bytes occpied by the "int" datatype is "4".
|
| 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.
|
|
|
|