Data type in c is a kind of identifier to be used to tell the compiler or interpreter how the programmer intended to use the data.

It is used to define/declare a variable. It specifies data storage format for the variable.

Generally, There are three types of data types in c.

  • Primitive Type ( Int, Char, Float, Double, Void)
  • Derived Datatype ( Array, Function, Pointers)
  • User Defined Datatype ( Structure, Union, Enumeration)

C supports the following basic data types:
int: integer, a whole number.
float: floating point, a number with a fractional part.
double: double-precision floating point value.
char: single character.

The amount of storage required for each of these types varies by platform.
C has a built-in sizeof operator that gives the memory requirements for a particular data type.

Simple Program to identify sizeof basic operator:

int main(){
  printf("int: %ld \n", sizeof(int));
  printf("float: %1d \n", sizeof(float));
  printf("double: %ld \n", sizeof(double));
  printf("char: %ld \n", sizeof(char));
  return 0;


int: 4 
float: 4 
double: 8 
char: 1 

Full Program to identify size of signed and unsigned data types:

/* Sizeof.c--Program to tell byte size of the C variable */
#include <stdio.h>

int main(void) {
    printf("\nA Char is %d bytes", sizeof( char ));
    printf("\nAn int is %d bytes", sizeof( int ));
    printf("\nA short is %d bytes", sizeof( short ));
    printf("\nA long is %d bytes", sizeof( long ));
    printf("\nA long long is %d bytes\n", sizeof( long long ));
    printf("\nAn unsigned Char is %d bytes", sizeof( unsigned char ));
    printf("\nAn unsigned int is %d bytes", sizeof( unsigned int));
    printf("\nAn unsigned short is %d bytes", sizeof( unsigned short ));
    printf("\nAn unsigned long is %d bytes", sizeof( unsigned long ));
    printf("\nAn unsigned long long is %d bytes\n",
            sizeof( unsigned long long ));
    printf("\nfloat is %d bytes", sizeof( float ));
    printf("\nA double is %d bytes\n", sizeof( double ));
    printf("\nA long double is %d bytes\n", sizeof( long double ));

    return 0;



A Char is 1 bytes
An int is 4 bytes
A short is 2 bytes
A long is 8 bytes
A long long is 8 bytes

An unsigned Char is 1 bytes
An unsigned int is 4 bytes
An unsigned short is 2 bytes
An unsigned long is 8 bytes
An unsigned long long is 8 bytes

float is 4 bytes
A double is 8 bytes

A long double is 16 bytes