Datatypes

All variables use data-type during declaration to restrict the type of data to be stored. Therefore, we can say that data types are used to tell the variables the type of data it can store. Whenever a variable is defined in C++, the compiler allocates some memory for that variable based on the data-type with which it is declared. Every data type requires a different amount of memory.Data types are mainly devided into three categories:-

  1. Primary Datatype
  2. Derived Datatype
  3. User defined Datatype











Primary Data Types:
These datatype are build-in or predefined datatype and can be used directly by user to declare variables.Primitive datatype available in c++ are-
  • Integer
  • Character
  • Boolean
  • Floating Point
  • Double Floating Point
  • Void(valueless)
  • Wide Character
Derived Data Types:
The datatype that are derived from the primitive datatype and build-in datatypes are reffered as derived datatype.These are of 4 types-
  • Function
  • Pointer 
  • Array 
  • Reference
User Defined Data Types-
User defined datatypes are also known as abstract datatypes,these are defined by user itself Like defining the class in C++ or structure.
  • Class
  • Union
  • Structure
  • Enumeration
  • Typedef defined datatype
             Datatype Modifiers:             
C++ allows the char,int and double datatypes to have modifiers preceding them.A modifier is used to alter the meaning of the base type.
The data types modifiers are -
  • Signed
  • unsigned
  • Long
  • Short
The modifiers signed,unsigned,long and short can be applied to integers base types.
tn addition,signed and unsined can be applied to char,and long can be applied to double.
The modifiers signed and unsigned can also be used as prefix to long or short modifier.

Comments

Popular posts from this blog

Covid-19 Analysis and Visualization using Plotly Express

Artificial Intelligence (Problem Solving)

Linear Regression