Tutorials

C Operator


C sizeOf operator


In C, sizeof() operator is used to calculate and return the size of its operand. 

sizeof() is a unary operator as it takes one operand only.

 

To understand in details, let's have a look at the given example:

 

Example of sizeof() operator

#include<stdio.h>
#include<conio.h>
void main()
{

    int a;
    short b;
    char c;
    double d;

    printf("    OUTPUT    \n");
    printf("size of a=%d\n",sizeof(a));
    printf("size of b=%d\n",sizeof(b));
    printf("size of c=%d\n",sizeof(c));
    printf("size of d=%d\n",sizeof(d));
    getch();
}

OUTPUT:

C sizeof operator

 

 



Please Share this page
Views : 75
Like every other website we use cookies. By using our site you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service. Learn more Got it!