Search Contact information
University of Cambridge Home Department of Engineering
University of Cambridge >  Engineering Department >  computing help
next up previous
Next: Expressions Up: C++ Summary Previous: Constants

Built-in types

int for whole numbers e.g. 3276, -1, 0, 4, 20
float for real numbers e.g. 2.703, 1.2e10, -4.0e-2
double for real numbers, greater precision e.g. 3.141592654, 6e23, 1.6022e-19
char for character values e.g. 'A', 'b', 'X', '9', '?'
bool for logical values true and false  

Note that short int and long int are also available, and may be represented by fewer or more bits than int. unsigned int, short unsigned int and long unsigned int can be used to hold zero-or-positive whole numbers.
© Cambridge University Engineering Dept
Information provided by Tim Love
2006-12-08