孤儿泪简谱:[c]这段代码中注释的部分哪儿有问题

来源:百度文库 编辑:神马品牌网 时间:2024/04/30 07:04:18
#include <stdio.h>
#include <stdlib.h>
#include "type.h"
#include "sub_fun.h"
extern int total;
student* creat(int n,student *head)//¿ª±ÙеĽáµã
{
student *p1,*p2;
int sum,i;
char out;
sum=total;
if(n==0)
{
printf("¼Èë½áÊø\n");
return(head);
}
else
{
p1=p2=(student *)malloc(LEN1);
printf("ÇëÊäÈëµÚ%d¸öѧÉúµÄѧºÅ£º",total+1);
gets(p1->num);out=getchar();
printf("ÇëÊäÈëµÚ%d¸öѧÉúµÄÐÕÃû£º",total+1);
gets(p1->name);out=getchar();out=getchar();
printf("ÇëÊäÈëµÚ%d¸öѧÉúµÄÐÔ±ð£º",total+1);
scanf("%c",&p1->sex);out=getchar();
printf("ÇëÊäÈëµÚ%d¸öѧÉúµÄÄêÁ䣺",total+1);
scanf("%d",&p1->age);
/*for(i=0;i<7;i++)
{
printf("ÇëÊäÈëµÚ%d¸öѧÉúµÄµÚ%dÃųɼ¨:",total+1,i+1);
scanf("%f",&p1->score[i][0]);
}*/
for(;total<=sum+n-1;total++)
{
if(total==0)
head=p1;
else
{
p2->next=p1;
p2=p1;
p1=(student *)malloc(LEN1);
printf("ÇëÊäÈëµÚ%d¸öѧÉúµÄѧºÅ£º",total+1);
gets(p1->num);out=getchar();
printf("ÇëÊäÈëµÚ%d¸öѧÉúµÄÐÕÃû£º",total+1);
gets(p1->name);out=getchar();
printf("ÇëÊäÈëµÚ%d¸öѧÉúµÄÐÔ±ð£º",total+1);
scanf("%c",&p1->sex);out=getchar();
printf("ÇëÊäÈëµÚ%d¸öѧÉúµÄÄêÁ䣺",total+1);
scanf("%d",&p1->age);
/*for(i=0;i<=6;i++)
{
printf("ÇëÊäÈëµÚ%d¸öѧÉúµÄµÚ%dÃųɼ¨:",total+1,i+1);
scanf("%f",&p1->score[i][0]);out=getchar();
}*/
}
}
p2->next=NULL;
return(head);
}
}
我为了告诉你们在哪里才加注释的
你们自己去掉注释了测试
我用vc好不,程序测试到注释的那段代码那里就出错了

从哪里拷贝的程序吧?用的TC吧?把注释全部删除了,TC不支持"//"作为注释。

还有你的sub_fun.h是什么内容?对于student的结构体类型是不是定义正确了?