我的程序为什么显示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
我的程序如下:
#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) ;
即可
是个简单的问题,就是 数据类型 不 匹配.转换哈就可以了
为什么我的机子老是死机,checking之后显示the type of the file system is FAT32
type命令如何显示指定的文件
为什么电脑开机的时候会显示“type the name of the command Interpreter"
为什么电脑开机的时候会显示“type the name of the command Interpreter
为什么我的开始菜单没有显示打开过的程序?
为什么我的任务栏不显示打开的程序?
我的任务栏为什么显示不了在活动的程序?
Windows 的True type 造字程序如何使用?
win2000的造字程序true type启动不了
为什么我的空间显示IE安装程序无法查找..