#include <stdio.h>
#include <stdlib.h>
struct node{
int data;
struct node *next;
};
node * InitLink()
{
node *p,*head,*newNode;
head = (node*)malloc(sizeof(node));
p = head;
int array[] = {122,133,313,122,11,12,22,85,52};
int i = 0;
while(i<sizeof(array)/sizeof(int))
{
newNode = (node*)malloc(sizeof(node));
newNode->data = array[i];
p->next = newNode;
p = p->next;
p->next = NULL;
i++;
}
head = head->next;
return head;
}
int main()
{
node *head = InitLink();
return 0;
}
C 单链表创建
最新推荐文章于 2022-05-03 22:04:20 发布