Tuesday, October 29, 2019

"sizeof" function in c language

#include <stdio.h>
#include <stdlib.h>

int main()
{
   int a =0;
   char c="b";
   float d=1.10;
   long e=12345678;
   double f=1234567812345;
   long double g=123456789;
   printf("int==%d\nchar==%d\nfloat====%d",sizeof(a),sizeof(c),sizeof(d));
   printf("\nlong==%d",sizeof(e));
   printf("\ndouble==%d",sizeof(f));
   printf("\nlong double==%d",sizeof(g));
    return 0;
}

output:

int==4
char==1
float====4
long==4
double==8

long double==12

note :i am using code block ide ...so my values are like this ....if your using any other compiler then values will be changed as per the compiler

No comments:

Post a Comment

python class topic video