标题:请大家帮忙看看,谢谢!
只看楼主
小伊
Rank: 2
等 级:论坛游民
帖 子:27
专家分:33
注 册:2010-4-17
结帖率:66.67%
已结贴  问题点数:10 回复次数:3 
请大家帮忙看看,谢谢!
#include<stdio.h>
#include<string.h>
#define LA 4
#define LB 5
struct student
{
 long num;
 char name[8];
 struct student *next;
}a[LA],b[LB];
int main(void)
{
    struct student a[LA]={{1,"wang"},{2,"li"},{3,"zhang"},{4,"wei"}};
    struct student b[LB]={{3,"zhang"},{4,"ma"},{5,"chen"},{6,"guo"},{10,"lui"}};
    struct student *p,*p1,*p2,*pa1,*pa2,*pb1,*pb2,*heada,*headb;
    heada=p1=a;
    headb=p2=b;
    printf("list a\n");
    while(p1!=NULL)
    {
      printf("%ld   %s\n",p1->num,p1->name);
      p1=p1->next;
    }
    printf("list b\n");
    while(p2!=NULL)
    {
     printf("%ld  %s\n",p2->num,p2->name);
      p2=p2->next;
    }
}
我想要它完全显示出来,大家运行一下就知道我的问题了
谢谢!
搜索更多相关主题的帖子: zhang long 
2010-06-18 16:01
小伊
Rank: 2
等 级:论坛游民
帖 子:27
专家分:33
注 册:2010-4-17
得分:0 
呜呜!大哥大姐解释一下吗
2010-06-18 16:25
key8714
Rank: 2
等 级:论坛游民
帖 子:48
专家分:87
注 册:2010-6-9
得分:5 
回复 2楼 小伊
2010-06-18 22:48
waterstar
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:小飞侠
威 望:5
帖 子:984
专家分:2810
注 册:2010-2-12
得分:5 
#include<stdio.h>
#include<string.h>
#define LA 4
#define LB 5
struct student
{
long num;
char name[8];
struct student *next;
}a[LA],b[LB];
int main(void)
{
    struct student a[LA]={{1,"wang"},{2,"li"},{3,"zhang"},{4,"wei"}};
    struct student b[LB]={{3,"zhang"},{4,"ma"},{5,"chen"},{6,"guo"},{10,"lui"}};
    for(int i=0;i<LA-1;i++)
        a[i].next=&a[i+1];
    a[i].next=NULL;
    for(int j=0;j<LB-1;j++)
        b[j].next=&b[j+1];
    b[j].next=NULL;

    struct student *p,*p1,*p2,*heada,*headb;
    heada=p1=a;
    headb=p2=b;
    printf("list a\n");
    while(p1!=NULL)
    {
      printf("%ld   %s\n",p1->num,p1->name);
      p1=p1->next;
    }
    printf("list b\n");
    while(p2!=NULL)
    {
     printf("%ld  %s\n",p2->num,p2->name);
      p2=p2->next;
    }
}

冰冻三尺,非一日之寒;士别三日,不足刮目相看!
2010-06-19 12:23



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




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

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