尾指针循环链表
不太会用尾指针,求大佬写一个用尾指针初始化循环链表的函数我参考一下tyepedef struct Node{
ElemType data;
struct Node *next;
}Node,*LinkList;
InitList(LinkList *L)
{
}
//循环链表实现对循环链表的初始化,创建,插入,删除,输出操作
//它只设置尾指针rear,这时头节点为rear->next
#include<stdio.h>
#include<stdlib.h>
#include<malloc.h>
typedef struct node{ //定义单链表的节点
int data;
struct node *next;
}linklist;
linklist *head,*rear; //声明一个表头和尾指针
linklist *createlist() //初始化一个循环链表
{
head = (linklist*)malloc(sizeof(linklist));
rear=head;
rear->next=head;
return head;
}
来自
https://blog.csdn.net/qq_37962204/article/details/79045593?ops_request_misc=%25257B%252522request%25255Fid%252522%25253A%252522161198765616780265418638%252522%25252C%252522scm%252522%25253A%25252220140713.130102334.pc%25255Fall.%252522%25257D&request_id=161198765616780265418638&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~first_rank_v2~rank_v29-2-79045593.pc_search_result_cache&utm_term=%25E7%2594%25A8%25E5%25B0%25BE%25E6%258C%2587%25E9%2592%2588%25E5%2588%259D%25E5%25A7%258B%25E5%258C%2596%25E5%25BE%25AA%25E7%258E%25AF%25E9%2593%25BE%25E8%25A1%25A8
页:
[1]