Ads block

Banner 728x90px

Data Types

A data type identifies the type of data which is stored in the variable such as integer, floating, character, etc.

There are following data types in C language.

TypesData Types
Primary Data Typeint, float, char, double and void
Derived Data Typearray, pointer
User-defined Data Typestructure, union, enumeration

Primary Data Type

C compilers support all these primary data types.

Data TypeDescription
intint data type is used to specify integer
charchar data type is used to specify character.
float, doubleBoth are used to denote floating point numbers.
voidAs the name suggests, it holds no value and is generally used for specifying the type of function or what it returns. If the function has a void type, it means that the function will not return any value.

Derived Data Type

Some derived data types and its descriptions are given below:

Data TypeDescription
arrayarray is used when we need a lot of variables to store similar type of data items.
pointerPointers are used to store address. A multiplication symbol '*' (known as astrick) denotes pointer variable. Example: int*, float*, char* etc.

User-defined Data Type

The data type which is defined by the programmer known as user-defined data type. By the help of given data types, a programmer can define a new type of identifier for variables.

Data TypeDescription
structureA structure is a collection of different type of data items.
unionProgrammers can define a union with different members, but only a single member can contain a value at a given time.
enumerationEnumeration is a special data type that consists of integral constants, and each of them is assigned with a specific name. "enum" keyword is used to define the enumerated data type.