CPP Data Types Examples

💻 CPP Data Types Examples with Output (Beginner → Exam → Interview)
Below are clear, practical examples of CPP Data Types Examples, each with code and output for easy understanding.
1️⃣ Integer Data Type (int) ⭐
Output
2️⃣ Floating Data Type (float) ⭐
Output
3️⃣ Double Data Type (double) ⭐
Output
4️⃣ Character Data Type (char) ⭐
Output
5️⃣ Boolean Data Type (bool) ⭐
Output
📌 true → 1, false → 0
6️⃣ String Data Type (string) ⭐
Output
7️⃣ Multiple Data Types Together ⭐⭐
Output
8️⃣ Derived Data Type – Array ⭐⭐
Output
9️⃣ User-Defined Data Type – struct ⭐⭐
Output
🔟 Size of Data Types ⭐⭐
Sample Output
📌 Size may vary by compiler/system.
📌 Common Exam Questions
Q1. Which data type stores decimal values?
👉 float, double
Q2. Which data type stores true/false?
👉 bool
Q3. Which data type stores text?
👉 string
✅ Summary
✔ int → whole numbers
✔ float / double → decimals
✔ char → single character
✔ bool → true/false
✔ string → text
✔ Arrays & structs → complex data
