搞定!
我改过来啦:不是倒的了,
static void CreateList(LinkList *head)
{
int data;
ListNode *p, *q;
q = NULL;
printf("Enter the number:\n");
scanf("%d", &data);
while (data != 0)
{
if ((p = (LinkList)malloc(sizeof(ListNode))) == NULL)
{
exit(1);
}
p -> data = data;
if (*head == NULL) *head = p;
else
q -> next = p;
q = p;
if (q != NULL)
q -> next = NULL;
printf("Enter the number:\n");
scanf("%d", &data);
}
}
奋斗改变一切!!