Showing posts with label operator. Show all posts
Showing posts with label operator. Show all posts

Thursday, April 10, 2014


Sizeof operator calculate the size of data i.e. how many bit a specific data having.

Syntax of sizeof operator :

printf("<format string>",sizeof<(data type variable)>);


 /*Program to sizeof operator*/
 #include<stdio.h>
 #include<conio.h>
 void main()
 {
  int x=10;
  clrscr();
  printf("
Size of  x is %d"
,sizeof(x));
  getch();
 }


  Output of above program :

  Size of x is 2 


We read in data type chapter that an int allocate only 2 byte in memory,Hence, x = 2.

Read More..