我想为链表定义一个结构,从接下来的两个选项中,其中一个主题更好?他们俩都会工作吗?有什么不同,你将使用哪一个?
typedef struct suppliers * SUP;
typedef struct suppliers{
int num;
int moths;
SUP next;
} su;
Run Code Online (Sandbox Code Playgroud)
其他选项是:
typedef supplier *suppliers
typedef struct supplier{
int num;
int moths;
struct supplier *next;
} supplier;
Run Code Online (Sandbox Code Playgroud)
小智 5
我的首选版本:
struct supplier{
int num;
int moths;
struct supplier *next;
};
Run Code Online (Sandbox Code Playgroud)
struct,enum或union上的typedef隐藏了有用的信息.