#include<stdio.h>
#include<malloc.h>
typedef int elemtype;
typedef struct LNode {
elemtype data;
struct LNode* next;
} LNode;
void Initlist(LNode* a)
{
a = (LNode*)malloc(sizeof(LNode));
a->next = NULL;
};
void Headinsert(LNode* a, int n)
{
a = (LNode*)malloc(sizeof(LNode));
a->next = NULL;
for (int i = n; i > 0; i--)
{
LNode* p = (LNode*)malloc(sizeof(LNode));
scanf_s("%d", &(p->data));
p->next = a->next;
a->next = p;
};
};
void printlinklist(LNode* a)
{
LNode* q = a;
while (q!=NULL)
{
printf("%d", q->data);
q = q->next;
};
};
int main(void)
{
LNode L;
Initlist(&L);
Headinsert(&L, 3);
printlinklist(&L);
};