cppreference.com > C/C++ Data Types

C/C++ Data Types

There are five data types for C: void, int, float, double, and char.

Type Description
void associated with no data type
int integer
float floating-point number
double double precision floating-point number
char character


C++ defines two more: bool and wchar_t.

Type Description
bool Boolean value, true or false
wchar_t wide character


Type Modifiers

Several of these types can be modified using signed, unsigned, short, and long. When one of these type modifiers is used by itself, a data type of int is assumed. A complete list of possible data types follows:

bool
char
unsigned char
signed char
int
unsigned int
signed int
short int
unsigned short int
signed short int
long int
signed long int
unsigned long int
float
double
long double
wchar_t

Type Sizes and Ranges

The size and range of any data type is compiler and architecture dependent. The "cfloat" (or "float.h") header file often defines minimum and maximum values for the various data types. You can use the sizeof operator to determine the size of any data type, in bytes. However, many architectures implement data types of a standard size. ints and floats are often 32-bit, chars 8-bit, and doubles are usually 64-bit. bools are often implemented as 8-bit data types.