Variables & Data Types

Data Types

C++ Data Types 📊

C++ has several fundamental data types.

Numeric Types

TypeSizeExample
int
4 bytes42
short
2 bytes100
long
8 bytes1000000L
float
4 bytes3.14f
double
8 bytes3.14159

Other Types

TypeDescription
char
Single character
bool
true/false
string
Text (needs
#include <string>
)

Declaration

int age = 25;
double price = 19.99;
char grade = 'A';
bool isActive = true;
std::string name = "Alice";
Visualizer
25
assigned to
25
age

Interactive Visualization

c
Loading...
Output
Run execution to see output...