#include<stdio.h>
#include<stdlib.h>
#include<malloc.h>
#include<string.h>
#define N 3
typedef struct node
{
char name[20];
struct node *next;
}ListNode;
ListNode *creat(int n)
{
ListNode *p,*h,*s;
int i;
if((h=(ListNode*)malloc(sizeof(ListNode)))==NULL)
{
printf("不能分配内存空间!");
exit(0);
}
h->name[0] = '\0';
h->next=NULL;
p = h;
for(i = 0;i<n;i++)
{
if((s=(ListNode*)malloc(sizeof(ListNode)))==NULL)
{
printf("不能分配内存空间!");
exit(0);
}
p->
单链表插入(完整版程序 在表头和表尾插入算法)
最新推荐文章于 2024-04-19 11:08:57 发布