Int / Integer Data Type
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".