C++ Data Types Cheat Sheet
1. Integer Types
int: 32-bit, -2B to 2B (e.g., int x = 10;)
long: At least 32-bit (e.g., long y = 100000;)
long long: 64-bit, for very large numbers (e.g., long long z = 1e18;)
short: 16-bit, smaller values (e.g., short s = 100;)
unsigned: Positive only (e.g., unsigned int u = 500;)
2. Floating-Point Types
float: 4 bytes, ~6 digits precision (e.g., float x = 3.14f;)
double: 8 bytes, ~15 digits precision (e.g., double y = 3.141592;)
long double: More precision (used rarely)
3. Character and Text
char: Single character (e.g., char c = 'A';)
string: Text (e.g., string name = "An";)
char[]: C-style string (lower-level)
4. Boolean (Logical)
bool: true or false (e.g., bool check = true;)
5. Array and Vector
int a[100]; // Fixed-size array
vector<int> v; // Dynamic array
v.push_back(5); // Add element
v.size(); // Get size
6. Advanced Types
pair<int, int> p = {1, 2};
tuple<int, string, double> t;
C++ Data Types Cheat Sheet
struct Student { string name; int age; };