#include <stdio.h>
#include <stdlib.h>
/* 节点*/
struct node
{
int data;
struct node *next;
};
typedef node* List;
int main(int data[], int n)
{
/* 初始化头指针*/
struct node * header = NULL;
while (n-- > 0) {
/* 分配空间*/
struct node * tmp = (struct node *)malloc(sizeof(node));
if (tmp == NULL) return NULL;
/* 初始化节点*/
tmp->data = data[n];
tmp->next = header;
header = tmp;
}
return (int)header;
}