标题:输出时,只能输出第一个而且系统出错
取消只看楼主
NIALK
Rank: 1
等 级:新手上路
帖 子:15
专家分:6
注 册:2019-2-3
结帖率:0
 问题点数:0 回复次数:0 
输出时,只能输出第一个而且系统出错
#include <stdio.h>
#include <stdlib.h>
int main()
{
      struct Student
      {
       int a;
       struct Student *next;
      }s,*p=NULL,*q=NULL,*head=NULL;
      head=p=&s;
      q=p->next;
     scanf("%d",&p->a);
      while(p->a!=0)
      {q=malloc(sizeof(struct Student));
       p=q;
       q=p->next;
       scanf("%d",&p->a);
      }
       q=NULL;
       p=head;
      while(p->a)
      {
       printf("%d",p->a);
       p=p->next;
  }

}
搜索更多相关主题的帖子: 输出 Student next NULL head 
2019-03-22 10:31



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-493726-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.444543 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved