LinkList List_HeadInsertLinkList L LNode s; int x; L = LinkListmallocsizeofLNode; L-next = NULL; scanfd&x; while x!=999 s = LinkListmallocsizeofLNode; s-data = x; s-next = L-next; L-next = s; s
#include <stdio.h> #include <stdlib.h>
typedef struct LNode { int data; struct LNode* next; } LNode, *LinkList;
LinkList List_HeadInsert(LinkList* L) { LNode* s; int x; *L = (LinkList)malloc(sizeof(LNode)); (*L)->next = NULL; scanf("%d", &x); while (x != 999) { s = (LinkList)malloc(sizeof(LNode)); s->data = x; s->next = (*L)->next; (*L)->next = s; scanf("%d", &x); } return *L; }
原文地址: http://www.cveoy.top/t/topic/h36m 著作权归作者所有。请勿转载和采集!