typedef struct aa
{ int data; //数据域
struct aa *next; //指针域
} NODE;
NODE *Creatlink(int n, int m)
{ NODE *h=NULL, *p, *s;
int i;
p=(NODE *)malloc(sizeof(NODE)); //动态分配内存
h=p; //临时结构体指针变量h保存指针p的初始位置
p->next=NULL; //先建立带头结点的空链表
for(i=1; i<=n; i++)
{ s=(NODE *)malloc(sizeof(NODE));
s->data=rand()%m; s->next=p->next;
p->next=s; p=p->next;
}
return h;
}