struct Node
{
long int number;
struct Node *next;
};
#include<stdlib.h>
#include<stdio.h>
#include<malloc.h>
#define L sizeof(struct Node)
//创建链表函数
struct Node *create(int a)
{
int n;
struct Node *p1, *p2, *head;
head = NULL;
n = 0;
p2 = p1 = (struct Node *)malloc(L);//分配内存
scanf("%ld", &p1->number);
while (a)
{
n = n + 1;
if (n == 1)
head = p1;
else
p2->next = p1;
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余4页未读,立即下载