C语言 错误提示“在函数XX中调用了太少的参数”

来源:百度知道 编辑:UC知道 时间:2024/06/14 09:05:16
#include<stdio.h>
#include<stdlib.h>
#define LEN sizeof(struct list)
struct list
{ long num;
char name[20];
float score;
struct list*next;
};
int count;/*全局变量,用于计数*/

/*New Lsit*/
struct list*new(void)
{
struct list*head,*p1,*p2;
count=0;
p1=p2=(struct list*)malloc(LEN);
scanf("%ld%s%f",&p1->num,p1->name,&p1->score);
head=NULL;
while(p1->num!=-1)
{count=count+1;
if(count==1)head=p1;
else p2->next=p1;
p2=p1;
p1=(struct list*)malloc(LEN);
scanf("%ld%s%f",&p1->num,p1->name,&p1->score);
}
p2->next=NULL;
return (head);
}

/*Outprint*/
void outprint(struct list*head)
{struct list*p;
if(head==NULL)
printf("No Records!");
else
{ p=head;
do
{ printf("\nThe %d record

void outprint(struct list*head)
要传一个list *型的参数给outprint啊,但你在main中调用时只写了outprint(),没传参数,当然不行.
而且你的new()执行之后,返回值也没传给head.都没建好list,你怎么outprint

老兄,你是真不懂还是装不懂啊,你个outprint()传参数了吗,

楼上正解,case2中的output中没有参数,你应该传一个list类型的指针,比如head,p1等,具体看你要实现什么嘛。还有最后一行的getch()我没看明白有什么作用。要想帮忙改的话请说明你要实现的功能,,,因为我有点懒啦。。。