size of a datatype without using sizeof

后端 未结 21 1971
慢半拍i
慢半拍i 2020-12-01 02:34

I have a data type, say X, and I want to know its size without declaring a variable or pointer of that type and of course without using sizeof oper

21条回答
  •  不思量自难忘°
    2020-12-01 03:01

        main()    
        {
        clrscr();
        int n;
        float x,*a,*b;//line 1
        a=&x;
        b=(a+1);
        printf("size of x is %d",
        n=(char*)(b)-(char*)a);
        }
    

    By this code script the size of any data can be calculated without sizeof operator.Just change the float in line 1 with the type whose size you want to calculate

提交回复
热议问题