C - Find the size of structure

后端 未结 7 851
隐瞒了意图╮
隐瞒了意图╮ 2021-02-10 01:39

I was asked this as interview question. Couldn\'t answer.

Write a C program to find size of structure without using the sizeof operator.

7条回答
  •  孤城傲影
    2021-02-10 01:54

    struct ABC
    {
        int a, b[3];
        int c;
        float d;
        char e, f[2];
    };
    int main()
    {
        struct ABC *ptr=(struct ABC *)0;
        clrscr();
        ptr++;
        printf("Size of structure is: %d",ptr);
        return 0;
    }
    

提交回复
热议问题