How to find the size of a variable without using sizeof

后端 未结 10 1726
终归单人心
终归单人心 2020-12-17 06:07

Let us assume I have declared the variable \'i\' of certain datatype (might be int, char, float or double) ...

NOTE: Simply consider that \'i\' is

10条回答
  •  青春惊慌失措
    2020-12-17 06:19

    int *a, *b,c,d;/* one must remove the declaration of c from here*/
    int c=10;
    a=&c;
    b=a;
    a++;
    d=(int)a-(int)b;
    printf("size is %d",d);
    

提交回复
热议问题