Home›Learn›C++›C++ Data Types
C++ MASTER COURSEBEGINNER FRIENDLY

C++ Data Types

Learn C++ Data Types with simple explanations, practical examples, coding exercises, MCQs and interview questions.

📖 Chapter 4 / 33⏱️ 8–12 Min Read🎯 Beginner Friendly
Course Progress12%
📘

Theory

Understand the concept step by step

C++ Data Types

Data types define the type of data that a variable can store.

Common C++ Data Types

Data TypeExample
int10
float10.5
double25.678
char'A'
booltrue
string"Hello"

Example

#include <iostream>
#include <string>
using namespace std;

int main() {
    int number = 10;
    double price = 99.50;
    char grade = 'A';
    bool passed = true;
    string name = "Alex";

    cout << number << endl;
    cout << price << endl;
    cout << grade << endl;
    cout << passed << endl;
    cout << name;

    return 0;
}
💻

Example

See how the concept works in real code

Python
#include <iostream>
#include <string>
using namespace std;

int main() {
    int number = 10;
    double price = 99.50;
    char grade = 'A';
    bool passed = true;
    string name = "Alex";

    cout << number << endl;
    cout << price << endl;
    cout << grade << endl;
    cout << passed << endl;
    cout << name;

    return 0;
}
📤

Output

Expected output of the example

output
10
99.50
A
1
Alex
📝

Practice

Try writing the program yourself

🎯 Practice Task

Rewrite the example program yourself without copying it. Then modify the values and observe how the output changes.

❓

MCQs

Test your understanding

❓

Quick Quiz

Test what you learned

Question 1 of 1Score: 0

What is the main topic covered in "C++ Data Types"?

💼

Interview Questions

Prepare for C++ interviews

1. What is C++ Data Types?+

Review the theory and example above to prepare a clear, practical answer for this question.

2. Why is C++ Data Types important in C++?+

Review the theory and example above to prepare a clear, practical answer for this question.

3. Give a practical example of C++ Data Types.+

Review the theory and example above to prepare a clear, practical answer for this question.

Chapter 4 of 33

Keep going — you're doing great! 🚀

12%