codeGK
Code it ALL
C++ Data Types - CodeGK
♦ C++ Data Types

♣ About C++ Data Types

Data Types are fundamentally classified based on the amount of memory for each Data Type.
Each Data Type has the capability of holding a different type of entity.
Some common occurring Data Types in C++ are int, float, and char.
Custom Data Types can also be created in C++, that will be covered in OOP(Object Oriented Programming) section.

♣ C++ Data Types

Data Types in C++ are majorly classified as.
  1. Primitive
  2. Complex
  3. User Defined

♣ Primitive Data Types in C++

Primitive Data Types are in-built Data Types which can be defined in one-line.
This include:-
  • int
  • float
  • double
  • bool
  • char
Below is a tabular explanation of DataTypes
Table Info
Data TypeSize(in Bytes)Range
int4-2,147,483,648 to 2,147,483,647
float4
double8
bool1/8, i.e, 1 bit0(false) or 1(true)
char1128keyboard characters + 128 other characters

♣ Modified Primitive Data Types in C++

There also exist Other versions of Primitive Data Types.
Below is a tabular explanation of DataTypes
Table Info
Data TypeSize(in Bytes)Range
short int2-32,768 to 32,767
unsigned short int20 to 65,535
unsigned int40 to 4,294,967,295
long int4-2,147,483,648 to 2,147,483,647
unsigned long int40 to 4,294,967,295
long long int8-(2^63) to (2^63)-1
unsigned long long int80 to 18,446,744,073,709,551,615
signed char1-128 to 127
unsigned char10 to 255
long double12
wchar_t2 or41 wide character

♣ Complex Data Types

Complex Data Types add a little more complexity while defining, but are also powerful.
This include:-
  • array
  • function
  • pointer
  • reference

♣ User-Defined Data Types

User-Defined Data Types are custom modified Data Type versions of the combination of Primitive and Complex Data Types.
This include:-
  • class
  • structure
  • union
  • enumeration
  • typedef
Prev_LessonNext_Lesson