Data-types in C Programming language

Data-types in c refer to an extensive system used for declaring variables or functions of different types. The type of a variable determines how much space it occupies in storage and how the bit pattern stored is interpreted.

There are the following data types in C language.

TypesData Types
Basic Data Typeint, char, float, double
Derived Data Typearray, pointer, structure, union
Enumeration Data Typeenum
Void Data Typevoid
  • Primary data types

• char: The most basic data type in C. It stores a single character and requires a single byte of memory in almost all compilers.
• Int: As the name suggests, an int variable is used to store an integer.
• Float: It is used to store decimal numbers (numbers with floating point value) with single precision.
• Double: It is used to store decimal numbers (numbers with floating point value) with double precision.

  1. Derived data types

Derived data types are nothing but primary data types but a little twisted or grouped together like array, structure, union and pointer. These are discussed in details later.

TypeSize (bytes)Format Specifier
intat least 2, usually 4%d, %i
char1%c
float4%f
double8%lf
short int2 usually%hd
long intat least 4, usually 8%ld, %li
long long intat least 8%lld, %lli
signed char1%c
long doubleat least 10, usually 12 or 16%Lf