Size of operator is used to estimate the size of the datatype, variable, expression etc,.
The size of the operator always written's and unsigned integer type.
EXAMPLE :
#include<limits.h>
#include<float.h>
main( )
{
double s;
clrscr( );
printf("size of integer : %d ",sizeof(int));
printf("size of float : %d ",sizeof(float));
printf("size of char : %d ",sizeof(char));
printf("size of s : %u ",sizeof(s));
printf("Integer maximum : %d ",INT_MAX);
printf("Float maximum : %e ",FLT_MAX);
getch( );
}
output :
size of integer : 2
size of float : 4
size of char : 1
size of s : 8
Integer maximum : 32767
Float maximum : 3.402823e+38
EXAMPLE :
main( )
{
char k;
clrscr( );
printf("%d %d %d %d %d %d",sizeof45,
sizeof k,sizeof(1.0),sizeof('A'),sizeof(32767),sizeof(0x345));
getch( );
}
output :
2 2 8 2 4 2
The size of the operator always written's and unsigned integer type.
EXAMPLE :
#include<limits.h>
#include<float.h>
main( )
{
double s;
clrscr( );
printf("size of integer : %d ",sizeof(int));
printf("size of float : %d ",sizeof(float));
printf("size of char : %d ",sizeof(char));
printf("size of s : %u ",sizeof(s));
printf("Integer maximum : %d ",INT_MAX);
printf("Float maximum : %e ",FLT_MAX);
getch( );
}
output :
size of integer : 2
size of float : 4
size of char : 1
size of s : 8
Integer maximum : 32767
Float maximum : 3.402823e+38
EXAMPLE :
main( )
{
char k;
clrscr( );
printf("%d %d %d %d %d %d",sizeof45,
sizeof k,sizeof(1.0),sizeof('A'),sizeof(32767),sizeof(0x345));
getch( );
}
output :
2 2 8 2 4 2