Data Types

Data type can be defined as the type of data of variable or constant store."

  • A data type in a programming language is a set of data with values having predefined characteristics.
  • Every variable reserve certain amount of memory. User gives input to a program as values. Values are of different type. User may give value as number or character.
  • Examples of data types are: integer, float, character, string, and pointer.
  • Ex: Age of person as int , Name of person as character.
  • Each type of value require different amount of memory.
  • As the data given by the user is different the type of data (i.e. number or character) is known as ‘data type’.
  • Different type of data require different amount of memory
Data are of two different types :
  • Number
  • Characters
Number Data Types :

Data Types Memory Reserve
Int 2 bytes
Long 4 bytes
Float 4 bytes
Double 8 bytes

Character Data Types ( char ) :

The char type is used to represent individual characters. The char type will generally require only One byte of memory.

    Ex: char k;