输出最后为什么一直是-1?
#include<stdio.h>#include<stdlib.h>
typedef int ElemType;
struct sNode
{
ElemType data;
struct sNode* next;
};
main()
{
struct sNode x,y,z;
struct sNode *p=&x;
printf("x,y,z=");
scanf("%d %d %d",&x.data,&y.data,&y.data);
x.next=&y;
y.next=&z;
z.next=NULL;
while(p!=NULL)
{
printf("%5d",p->data);
p=p->next;
}
printf("\n");
return 0;
}