长清城关派出所电话:C语言程序求解

来源:百度文库 编辑:杭州交通信息网 时间:2024/04/24 20:19:51
各位高手看一下下面这段多项式申明的代码哪儿有错,谢谢啦!
typedef struct plnode /*多项式结构声明*/
{
int coef; /*多项式的系数*/
int exp; /*多项式的指数*/
struct pllist *next; /*指向下一接点的指针*/
}plnode pllist;
谢谢各位,稍做补充:pllist 应该是个结构体指针.怎么修改呀?

typedef struct plnode /*多项式结构声明*/
{
int coef; /*多项式的系数*/
int exp; /*多项式的指数*/
struct pllist *next; /*指向下一接点的指针*/
}plnode pllist;

plnode和pllist应该是2个变量吧,用“,”隔开

typedef struct plnode /*多项式结构声明*/
{
int coef; /*多项式的系数*/
int exp; /*多项式的指数*/
struct pllist *next; /*指向下一接点的指针*/
}plnode, pllist;

首先,最后一行的plnode冗余了,
其次,在typedef还没有定义完之前,被定义的pllist是不能识别的。

修改意见:

typedef struct plnode pllist;

struct plnode /*多项式结构声明*/
{
int coef; /*多项式的系数*/
int exp; /*多项式的指数*/
pllist *next; /*指向下一接点的指针*/
};

或者

typedef struct plnode /*多项式结构声明*/
{
int coef; /*多项式的系数*/
int exp; /*多项式的指数*/
struct plnode* next; /*指向下一接点的指针*/
} pllist;