Home

A program to explain sizeof operator

C Programming Language 008

The following code shows how to write a program to explain sizeof operator

Program

#include <stdio.h>

void main()
{
    char c;
    int i;
    float f;

    i = sizeof(int);
    printf("The size of int is %d\n", i);
    printf("The size of char is %d\n", sizeof(c));
    printf("The size of float is %d\n", sizeof(float));

    printf("\n");
}

Result

The size of int is 4
The size of char is 1
The size of float is 4


Last Updated on

Next Post: Rules vs Guidelines →

Comments