HOME LIBRARY C++ PHP JAVA HTML
CSAdeeb

Datatypes in C

The datatypes in C programming are used to specify the type of data that the variables can hold. It restricts the variables to use a type of data in which the variable is declared.

If a variable declared as int datatype, then it can only have integer values. The datatypes in C language are divided into the following categories.

  • Fundamental (Primary) datatypes.
  • Derived datatypes.
  • User defined datatypes.

In this lesson we are discussing fundamental datatypes in C programming.

Fundamental Datatypes in C

C language supports the following fundamental datatypes.

  • Void type
  • Integer type
  • Character type
  • Floating point type

Void type

The Void type is used to indicate the no value variables. The void type is usually used to declare the functions that does not return any values. The void type functions are declared using the keyword void.

Integer type

Integer datatype includes the whole numbers in a range excluding floating point numbers. The keyword int is used to declare integer type variables.

Examples: 15, -20

Floating Point Type

Floating point type includes the numbers in a range that supports floating point numbers also. The keyword float is used to declare floating point type variables.

Examples: 0.15, 100.789

Character Type

The Character type variables can store a single character. The keyword char is used to declare character type variables. It can hold values like ‘a’, ‘5’ etc.