Data Types - richardjoo/cpp_study GitHub Wiki
Name Description Size* Range*
----------------------------------------------------------------------------------------------------------
char Character or small integer. 1byte signed: -128 to 127
unsigned: 0 to 255
short int (short) Short Integer. 2bytes signed: -32768 to 32767
unsigned: 0 to 65535
int Integer. 4bytes signed: -2147483648 to 2147483647
unsigned: 0 to 4294967295
long int (long) Long integer. 4bytes signed: -2147483648 to 2147483647
unsigned: 0 to 4294967295
bool Boolean value. 1byte true or false
It can take one of two values:
true or false.
float Floating point number. 4bytes +/- 3.4e +/- 38 (~7 digits)
double Double precision 8bytes +/- 1.7e +/- 308 (~15 digits)
floating point number.
long double Long double precision 8bytes +/- 1.7e +/- 308 (~15 digits)
floating point number.
wchar_t Wide character. 2 or 4 bytes 1 wide character
- The values of the columns Size and Range depend on the system the program is compiled for. The values shown above are those found on most 32-bit systems. But for other systems, the general specification is that int has the natural size suggested by the system architecture (one "word") and the four integer types char, short, int and long must each one be at least as large as the one preceding it, with char being always one byte in size. The same applies to the floating point types float, double and long double, where each one must provide at least as much precision as the preceding one.