我的程序为什么显示type mismatch error,好的回答追加80分!!

来源:百度知道 编辑:UC知道 时间:2024/05/06 04:50:18
我们要求编一个程序:要求Write a function to add two polynomials。Do not destroy the input。Use a linked list implementation

我的程序如下:
#include<stdio.h>

struct Node
{
int Coe;
int Exp;
struct Node *next;
};

struct Node *Add(struct Node *x,struct Node *y)
{
struct Node *head,*z;
z=(struct Node *)(malloc(sizeof(struct Node)));
if (!z)
FatalError("Error:Memory is full.");
head=z;
head->Exp=-1;
x=x->next;
y=y->next;
while(x&&y)
{
if (x->Exp>y->Exp)
{
Appen(x->Coe,x->Exp,z);
x=x->next;
continue;
}
if (x->Exp==y->Exp)
{
if (x->Coe+y->Coe)
Appen((x->Coe+y->Coe),x->Exp,z);
x=x->next;
y=y->next;
continue;
}
if (x->Exp<y->Ex

没有声明该函数而在Add函数中使用了它,在
struct Node
{
int Coe;
int Exp;
struct Node *next;
};
后面加上
void Appen(int a,int b,struct Node *c) ;
即可

是个简单的问题,就是 数据类型 不 匹配.转换哈就可以了