Programming in C (Part 3 - Type modifiers) — 10 July, 2015

We have already talked about variables and constants, now we will talk about type modifiers. The type modifiers define the memory reserved for the variable/constant.

In C we have the following modifiers:

Int

Char

Float and double

Printing the sizes of int with short and long modifiers:

#include <stdio.h>

int main()
{    
    printf("int : %d bytes\n", sizeof(int) );
    printf("short int: %d bytes\n", sizeof(short) );
    printf("long int: %d bytes\n", sizeof(long) );
    return 0;
}

Suggestion: Try this code with other data types.

References: