🔥Limited Offer: Get 50% OFFon AI & Full Stack Courses🔥
Back to C++ Notes
Topic #16

C++ Data Types


C++ Data Types

As explained in the Variables chapter, a variable in C++ must be a specified data type:

Example

int myNum = 5;
// Integer (whole number)
float myFloatNum = 5.99;
// Floating point number
double myDoubleNum = 9.98;   // Floating point number
char myLetter = 'D';
// Character
bool
myBoolean = true;       // Boolean
string myText = "Hello";
// String

Basic Data Types

The data type specifies the size and type of information the variable will store:

Data Type Size Description
bool 1 byte Stores true or false values
char 1 byte Stores a single character/letter/number, or ASCII values
int 2 or 4 bytes Stores whole numbers, without decimals
float 4 bytes Stores fractional numbers, containing one or more decimals. Sufficient for storing 6-7 decimal digits
double 8 bytes Stores fractional numbers, containing one or more decimals. Sufficient for storing 15 decimal digits

Note: You will learn more about the individual data types in the next chapters.

Want to go beyond the notes?

Join CodingNow 2.0's C++ course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available

C++ Data Types – FAQs

Quick answers about learning C++ Data Types in C++.

This free note from CodingNow 2.0 explains C++ Data Types in C++ — concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every C++ topic on CodingNow 2.0, including C++ Data Types, is 100% free with no signup required.
With focused practice, most students grasp C++ Data Types in 1–3 days from these notes; pairing it with CodingNow 2.0's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the CodingNow 2.0 Community (/community) — expert instructors answer within 24 hours.
WhatsApp
Call NowEnroll Now