#include #include typedef struct LNode{int data;struct LNode *next;}LNode,*LinkList;// }LNode;//int tail_insert(LinkList *L, int n)//int tail_insert(LinkList &L, int n)//static LNode *L;int HeadInsert(LinkList *L, int n){int i;//LinkList *s;LNode *s;LNode *p;// LNode *L=*M;//建立头节点// *T=(LNode *)malloc(sizeof(LNode));//(*T)->next=NULL;*L=(LinkList)malloc(sizeof(LNode));(*L)->next=NULL;//插入数据//for(i = n ;i > 0; i--)for(i = n ;i > 0; --i){//s = (LNode *)malloc(sizeof(LNode));//生成新数据s = (LinkList)malloc(sizeof(LNode));//生成新数据//scanf("s->data = ",&n);printf("please input data[%d]\n",i);//scanf(&s->data);//输入元素值scanf("%d",&s->data); printf("just input:%d\n",s->data);// s->next = (*T)->next;//插入到表头// (*T)->next = s; s->next = (*L)->next;(*L)->next = s;}// printf("the new link list is:\n");// for(p = L->next; p->next != NULL ; p=p->next)// printf("%d->",p->data);// printf("%d\n",p->data); return 0;}int main(){// LNode *L;LinkList l;LNode *p;//int tail_insert(&L,5);HeadInsert(&l,5);printf("the new link list is:\n");for(p = l->next; p->next != NULL ; p=p->next)printf("%d->",p->data);printf("%d\n",p->data); return 0;}