雙向鍊錶基本結構
typedef
struct pnode
pnode;
建立乙個雙向鍊錶,並列印出煉表中儲存的資料
#include
#include
//包含malloc函式
void main()
pnode;
/*第乙個節點head*/
pnode *head=malloc(sizeof(pnode));
head->
data=0;
head->pre=
null;
head->next=
null;
/*定義乙個鍊錶*/
pnode *node;
int i;
for(i=
1;i<
10;i++)
/*結束迴圈,建立了乙個鍊錶node*/
while(1)
printf("node->data=%x\n",node->
data);
node=node->pre;
}}
雙向鍊錶C語言
鍊錶結構定義 typedef struct node 建立鍊錶 int creat list struct node h h data 0 0 h llink null h rlink null return 1 清空鍊錶 int free list struct node h return 1 查...
C語言雙向鍊錶
原文 c語言雙向鍊錶 今天寫了點雙向鍊錶的各種操作,寫插入的時候費了點時間,不過,現在看來還是值得耗費那點時間去寫的,這種小東西應該能信手拈來才行啊。1 雙向鍊錶 2 include 3 include strcmp const char const char return 0 is equal 4...
C語言 雙向鍊錶
typedef struct datalistdatalist 頭插法插入 沿next指標查詢 返回 null 或pos處的元素指標 datalist value datalist head,const unsigned int pos if i pos return op else return ...