Data Types in C++
Data Types are used to define the operations and store each of them. Data types in C++ can be classified into three major categories :
1. User-defined data type
2. Built-in data type
3. Derived data type
User-defined data type:
In C++, User-defined data types are Structure, Union, Class and enum etc.
struct name { data type member1; data type member2; .............. }
union name { data type member1; data type member2; .............. }
Example :
enum shape{square, cirle}; enum color{blue, green};
Built-in data type:
In C++, Built-in data types are given as follows :
Type | Bytes | Range |
char | 1 | -128 to 127 |
unsigned | 1 | 0 to 255 |
int | 2 | -32768 to 32767 |
unsigned int | 2 | 0 to 65535 |
long int | 4 | -2147483648 to 2147483647 |
unsigned long int | 4 | 0 to 4294967295 |
float | 4 | 3.4E-38 to 3.4E+38 |
double | 8 | 1.7E-308 to 1.7E+308 |
long double | 10 | 3.4E-4932 to 1.1E+4932 |
Recommended Posts:
C++
1. Concepts of OOP
2. C++ input output functions
3. Data Types in C++
4. Operators in C++
5. Control Statements in C++ with Examples
6. Call by Value and Call by Reference in C++
7. Inline Function in C++
8. Default Arguments in C++
9. Function Overloading in C++ with Example
10. C++ Program to Find Factorial of Number
11. C++ Program to Solve Tower of Hanoi using Recursion