Fundamental Data Types in C++ Programming Language
Data types are declarations for variables. This determines the type and size of data associated with variables which is essential to know since different data types occupy different size of memory.
1. int
- This data type is used to store integers.
- It occupies 4 bytes in memory.
- It can store values from -2147483648 to 2147483647.
Eg. int age = 18;
2. float and double
- Used to store floating-point numbers (decimals and exponentials)
- Size of float is 4 bytes and size of double is 8 bytes.
- Float is used to store upto 7 decimal digits whereas double is used to store upto 15 decimal digits.
Eg. float pi = 3.14
double distance = 24E8 // 24 x 108
3. char
- This data type is used to store characters.
- It occupies 1 byte in memory.
- Characters in C++ are enclosed inside single quotes .
- ASCII code is used to store characters in memory.
Eg͘ char ch = 'a';
4. bool
- This data type has only 2 values ʹ true and false.
- It occupies 1 byte in memory.
- True is represented as 1 and false as 0.
Eg. bool flag = false
#Fundamental Data Types in C++
#Benefits of C++
#Benefits of Variables
#C++ Programing Language#C++
#CodeDelhi
#int,float and double
#char
#bool
#basic
#Derived
#Enumeration
#Void
#Google
#Microsoft
#Adobe