C怎么编译不通过啊~~~~~

来源:百度知道 编辑:UC知道 时间:2024/07/01 14:16:08
struct node
{
int data;
struct node *next;
}
main(
{
struct node a,b,c,*h,*p;
a.data=10;b.data=20;c.data=30;
h=&a;
a.next=&b;
b.next=&c;
c.next='\0';
p=h;
while(p);
{printf("%d ",p->data);
p=p->next;
}
printf("\n");
}

呵呵,没问题吧。。。

#include <stdio.h>

struct node
{
int data;
struct node * next;
};
int main()
{
struct node a,b,c,*h,*p;
a.data=10;b.data=20;c.data=30;
h=&a;
a.next=&b;
b.next=&c;
c.next='\0';
p=h;
while(p)
{
printf("%d ",p->data);
p=p->next;
}
printf("\n");
return(0);
}