请问这个链表的程序哪里错了啊,看了好久了都不懂...
#include <stdio.h>#include <stdlib.h>
#include <string.h>
struct stud_node
{
int num;
char name;
int score;
struct stud_node *next;
};
int main()
{
struct stud_node *head,*tail,*p;
int num,score;
char name;
int size = sizeof(structstud_node);
head=tail=NULL;
printf(“input num,name and score:\n”);
scanf(“%d”,&num);
while(num != 0)
{
p=malloc(size);
scanf(“%s%d”,name,&score);
p->num=num;
strcpy(p->name,name);
p->score=score;
p->next=NULL;
tail->next=p;
tail=p;
scanf(“%d”,&num);
}
for(p=head;p->next != NULL;p=p->next)
printf(“%d%s%d\n”,p->num,p->name,p->score);
return0;
} 首先你的所有""都是中文输入法的,别的就不知道了 心驰神往 发表于 2021-1-6 15:40
首先你的所有""都是中文输入法的,别的就不知道了
已经解决了感谢
页:
[1]