求大神解答
#include <stdio.h>//为什么输入没有问题 但输出就会使编译器崩溃呢#include <stdlib.h>
struct student
{
int nuw;
float fen;
char *name;
struct student *next;
}a,*head;
int i;
int main()
{
for(i=0;i<3;i++)
{
printf("请输入姓名");
scanf("%s",&a.name);
//
printf("\n请输入学号");
scanf("%d",&a.nuw);
printf("\n请输入分数");
scanf("%f",&a.fen);
}printf("%s",a.name);
head=&a;
for(i=0;i<3;i++)
{
a.next=&a;
}
a.next=0;
do
{
printf("%d %5.1f,%s\n",head->nuw,head->fen,head->name);
head=head->next;
}while(head);
}
struct student
{
int nuw;
float fen;
char name;
struct student *next;
}a,*head; ba21 发表于 2018-2-23 12:03
struct student
{
int nuw;
有什么问题吗
郑佳声爸爸 发表于 2018-2-23 12:54
有什么问题吗
你不会看啊。看没看就问有什么问题了。对比了吗? 注意 student结构体中的name并未分配内存
页:
[1]