Jump to content

C++ Lessons : 8. Data Types


quix
 Share

Recommended Posts

  • Manager

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

boolean

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

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

 

1.png.56210348f845fad9f2d8f843d77e3c16.png

Click! : adelinrzo

Click! quiixx.

Click! : raizo

 

Guardian of Leaks!

 

image.png.3ca1bf60c26a3523b93df92ea8521802.png (24.01.2023)

image.png.990bdf55e8ebaad7e92cc11967598b8d.png (12.03.2023)

image.png.25e5d76f6f7de46f49423812d3d500a3.png (30.03.2023)

Link to comment
Share on other sites

  • quix locked this topic
Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...