• Data type is type of the value that a variable can store.
  • Each variable has its own data type and each data type occcupies different size of memory storage.

Some commonly used data types are:

  • char : char is a data type which stores single character. It needs one byte memory.
  • Ex: char ch;
    • Here char is a data type that stores single character as its value.
    • Ch is variable name which stores the value of single character
  • Int : integer is a data type that is used to store numerical numbers. It requires four-byte memory.
  • Ex:int i;
    • Here int is a data type that stores numbers.
    • i is variable of type integers.
  • Float: is a data type that is used to store decimal numbers with one decimal point. It also requires 4 byte of memory.
  • Ex:float f;
    • Here float is a data type that stores decimal numbers with one decimal point. F is variable name.
  • double: is a data type that is used to store decimal numbers with two decimal point.
  • Ex:double d;
    • Here  double is a data type to store decimal value with two points.
    • d is a variable name.

 

Categorized in: