C data types

Data types are keywords which are used to assign a type to a variable. Mainly there are two type of data type

  • Basic data type
  • Derived data type

Further we can divide basic data type in two categories

  • Primary data type
  1. int
  2. char
  3. float
  4. double
  5. void
  • Secondary data type  – which is called modifier also.
  1. short
  2. long
  3. signed
  4. unsigned

Secondary data type is used to modified primary data type. See example below

int                                    money;
short  int                         money;
long  int                           money;
signed  char                    alphabet_1;
unsigned short int          balance;

Derived data type are derived from basic data types

  1. array
  2. pointer
  3. structure
  4. enumeration

User defined data type are derived from basic data type

Syntax:

typedef data_type new_data_type

Example:-

typedef int own;

int age;            -1

own age;         -2

Here both 1 and 2 declarations are similar.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.