It is used to get the size of a variable or data type i.e., number of btes allocated.
#include<stdio.h>
void main()
{
int x;
char y;
float z;
printf("x=%d\n",sizeof(x));
printf("int =%d\n",sizeof(int));
printf("y=%d\n",sizeof(y));
printf("char =%d\n",sizeof(char));
printf("z=%d\n",sizeof(z));
printf("float =%d\n",sizeof(float));
}
OUTPUT:
x=2
int =2
y=1
char=1
z=4
float=4
No comments:
Post a Comment