Cpp - Introduction Variable Types

Introduction

Variable types supported by C++ programs are shown in the following table.

It lists the variable type, the most common memory size, and the possible values that it can hold.

Type
Size
Values
unsigned short
2 bytes
0 to 65,535
short
2 bytes
-32,768 to 32,767
unsigned long
4 bytes
0 to 4,294,967,295
long
4 bytes
-2,147,483,648 to 2,147,483,647
int
4 bytes
-2,147,483,648 to 2,147,483,647
unsigned int
4 bytes
0 to 4,294,967,295
long long int
8 bytes
-9.2 quintillion to 9.2 quintillion
char
1 byte
256 character values
bool
1 byte
true or false
float
4 bytes
1.2e-38 to 3.4e38
double
8 bytes
2.2e-308 to 1.8e308

The short and long variables also are called short int and long int in C++.

Related Topic