不要进来
//运行结果不对#include"stdio.h"
typedef struct node
{ int data;
struct node *next;
}NODE;
main()
{ NODE *head,*p,*s;
int ch;
int x=1;
head=(NODE*)malloc(sizeof(NODE));
p=head;
while(x)
{ scanf("%d",&ch);
if(ch!=0)
{ s=(NODE*)malloc(sizeof(NODE));
s->data=x;
p->next=s;
p=s;
}
else x=0;
}
p->next=NULL;
p=head;
head=head->next;
while(p!=NULL)
{ printf("%d",&p->data);
p=p->next;
}
free(p);
} //我输入1 2 3 0 输出是 251425146.......................一大串数字
[此贴子已经被作者于2005-3-28 14:07:42编辑过]