|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
- #include<stdio.h>
- main()
- {
- typedef struct p;
- p stu
- {
- char *name;
- int age;
- p stu *next;
- }a,b,*p;
- a.name="hua";
- a.age='18';
- b.name="lia";
- b.age='19';
- p=&a;
- a.next=&b;
- b.next=NULL;
- while(p)
- {
- printf("%5s\n%5d\n",p->name,p->age);
- p=p->next;
- }
- }
复制代码
- #include<stdio.h>
- #include<string.h>
- typedef struct p {
- char name[64] ;
- int age ;
- struct p * next ;
- } sp ;
- main(void)
- {
- sp a , b , * p ;
- strcpy(a . name , "hua") ;
- a . age = 18 ;
- strcpy(b . name , "lia") ;
- b . age = 19 ;
- p = & a ;
- a . next = & b ;
- b . next = NULL ;
- while(p)
- {
- printf("%5s\n%5d\n" , p -> name , p -> age) ;
- p = p -> next ;
- }
- }
复制代码
|
|