C Language

May 22, 2023

How to use size of operators in c language

program to use size of operators in c language


#include<stdio.h>
int main()
{
    int var;
    printf("size of int =%u\n",sizeof(int));
    printf("size of float=%u\n",sizeof(float));
    printf("size of var=%u\n",sizeof(var));
    printf("size of an integer constant=%u\n",sizeof(45));
    return 0;

}

output


size of int =4
size of float=4
size of var=4
size of an integer constant=4

Steps Description

  1. Declare integer variable var
  2. printf inbuild function to display size of integer variable "var" using another inbuild function "size of()
  3. printf inbuild function to display size of float variable "var" using another inbuild function "size of()
  4. printf inbuild function to display size of"var" variable using another inbuild function size of()
  5. printf inbuild function to display size of in integer variable "var" using another function size of()

by : Ajaj Khan

Quick Summary:

use size of operators in c language