0

我使用前向声明,但仍然得到 ERROR: 'link' does not name a type。为什么?

struct link;

struct node
{
    link *head_link;            <------- this is the error location
    node *next_node;
};

struct link
{
    link *next_link;
    node *connect_node;
};
4

1 回答 1

0

你声明了一个叫做 struct link 的类型,它不仅仅是链接,所以写:

struct node
{
    struct link *head_link;
    struct node *next_node;
};

或者,声明一个名为 link 的类型typedef

于 2013-08-02T06:05:49.210 回答