< C++ Tutorial

C++ data types

← Previous Next →

Data types tell about the type of data a variable can hold. Whenever a variable is declared, it occupies some computer memory with space as required by the particular datatype.

Datatype size varies on the system architechture.
For example, int variable occupies 2bytes on some systems and 4 bytes on Unix systems.

Data types in C++ is mainly divided into two types:

  • Primitive data types
  • Abstract or User defined data types

Primitive data tyeps :

int 4 Integer number.
float 4 Decimal value
double 4 BIg decimal number
char 1 Character value
pointer( int*, char*) 2 Stores the address of variable

 Abstract or Use defined data types:

User defined data types stores multiple values either of same type or different type or both. 

  • Class
  • Union
  • Struct
← Previous Next →