Types of Variables

The chart below lists each type of variable available in C++.

 
Numerical Range
   
Keyword
Low
High
Digits of Precision
Bytes of Memory
char
-128
128
n/a
1
short
-32,768
32,768
n/a
2
int
-2,147,483,648
2,147,483,648
n/a
4
long
-2,147,483,648
2,147,483,648
n/a
4
float
3.4 * 10 E-38
3.4 * 10 E38
7
4
double
1.7 * 10 E-308
1.7 * 10 E308
15
8
long double
3.4 * 10 E -4932
3.4 * 10 E 4932
19
10
unsigned char
0
255
n/a
1
unsigned short
0
65,535
n/a
2
unsigned int
0
4,294,967,295
n/a
4
unsigned long
0
4,294,967,295
n/a
4

 

 

 

 

 

Source: Robert LaFore, Object Oriented Progarmming in C++, 3rd edition, Sams Publishing, 1999.