sizeof() in C 

This Sizeof Operator in C language page provides complete information about sizeof operator in C language with suitable examples.


 

sizeof(): Used to find out the size of

  • Variable
  • Data type
  • Expression
  • Array
  • Structure
  • Pointer
  • ……

 

#include<stdio.h>
main()
{
                char c ;
                short s ;
                printf(“size of char : %d\n”,sizeof(c));
                printf(“size of short : %d\n”,sizeof(s));
 }

 

#include<stdio.h>
main()
{
                clrscr();
                printf(“size of float : %d\n”,sizeof(float));
 }

 

#include<stdio.h>
main()
{
                short a=10,b,c,d;
                b=a ;
                c=a+b;
                d=sizeof(c);
                printf(“%d%d%d%d”,a,b,c,d);
 }

 

#include<stdio.h>
main()
{
                int a,c;
                long f;
                c=sizeof(a+f);
                printf(“%d”,c);
 }

 

#include<stdio.h>
main()
{
                int size;
                size = sizeof(void);
                printf(“%d”,size);
}

Share this