Data Types in C Language

All variable in the C programming has a declared data type. Every data type in C needs a certain amount of memory and has some precise operations that can be conducted over it.
Let us discuss them all one by one.


Data Types available in C

There are the following data types available in the C language

  1. Basic Data Type- The basic data types used in C are int, char, float, and double.
  2. Derived Data Type- Derived data types used in C are array, pointer, structure, and union.
  3. Enumeration Data Type- Enumeration data type used in C is enum.
  4. Void Data Type- The void data type used in C is void.


Basic data types used in C

char- Char is the most common data type used in C. It requires a single character and needs a single byte of memory in nearly all types of compilers.

int- According to its name, an int variable is utilized in C to store an integer value.

float- Float variable is used in C to store decimal value (numbers having floating-point value) with one preciseness.

double- Double is used in C to store decimal values (numbers having floating-point digits) with double preciseness. 

All data types have various ranges up to which they can store digits. These spans may differ from compiler to compiler.


Derived data types used in C

Array- An array is a type of the variable used in C that can store numerous values. It is a group of similar data items reserved at contiguous memory locations. Array elements can be accessed randomly by indexes.

Pointer- Pointer is a variable used in C language which reserves the address of another variable.

Structure- To create a structure, the "struct" keyword is used. It forms a data type that can be utilized to group items of various types into a single one.

Union- It is a data type that stores different types of data types in the same memory location.


Enumeration data type in C

Enum- Enum is mostly used to allocate names to integral constants. The allocated names create a program simple to read and maintain.

Void datatype in C

Void- Void represents empty and returns no value. We prefer to use void data type in functions while we don’t wish to return any value to the calling operation.