更新时间:2022-06-23 05:07:07
typedef struct
{
} Product;
为一个 unnamed 结构声明一个名为 Product
的类型别名 - 但是你需要一个 named 结构用于你的前向声明 struct Product*next;
,否则编译器无法确定它属于哪个定义.
Declares a type alias called Product
for an unnamed struct - however you need a named struct for your forward declaration struct Product *next;
, otherwise the compiler cannot determine which definition it belongs to.
最简单的解决方案是给结构一个名字:
The simplest solution is to give the struct a name:
typedef struct Product
{
int value;
struct Product *next;
} Product;