AsegGasiaBlog

C Programming - Operators - Size Of Operator

Size Of Operator

C provides a compiler-time unary operator called sizeof that can be used 

to compute the size of any object.

The expression such as:

  • sizeof object
  • sizeof(type name)

Example :


#include<stdio.h>

int main()
{

    printf("size of int in byte :  %d\n", sizeof(int));
    printf("size of char in byte %d\n", sizeof(char));
    printf("size of float in byte %d", sizeof(float));

    return 0;
}

Output :

 size of int in byte :  4
 size of char in byte 1
 size of float in byte 4

Popular Posts