#include<stdio.h>
#include<malloc.h>
struct Node
{
int data;
struct Node * next;
} ;
int main()
{
struct Node * head;
struct Node * flag;
head=(struct Node*)malloc(sizeof(struct Node));
flag=head;
scanf("%d",&flag->data);
while(flag->data!=0)
{
flag=(struct Node*)malloc(sizeof(struct Node));
flag=flag->next;
scanf("%d",&flag->data );
}
flag->next =NULL;
flag=head;
while(flag!=NULL)
{
printf("%d",flag->data );
flag=flag->next;
}
return 0;
}
flag=(struct Node*)malloc(sizeof(struct Node));
flag=flag->next;
你这个flag是新创建的 flag又等于新创建flag的next 指向哪里呢?