Self referring structure declaration

前端 未结 7 858
没有蜡笔的小新
没有蜡笔的小新 2021-01-21 04:00

The follwing declaration is valid.

struct node
{
    int a;
    struct node *next;
};

However, when we define the following, it gives error.

7条回答
  •  渐次进展
    2021-01-21 04:11

    Your second declaration would define a struct which is infinitely deeply nested, which is impossible.

提交回复
热议问题