错哪了??
#include<stdio.h>main()
{
typedef struct p;
pstu
{
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;
}
}{:10_266:} {:10_266:} #include<stdio.h>
#include<string.h>
typedef struct p {
char name ;
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 ;
}
}
页:
[1]