帶頭節點(指向頭節點的指標header不能改變位址!!!)每次輸入資料都要重新找回最後乙個節點,在輸出資料時,要把最後乙個節點的next指向null
#include
#include
typedef struct link node;
void builddoublelink(node**
header) else
last_node->next = new_node;
new_node->next =
*header;
}scanf("%d", &
data);
}}void print(node*
header)
last_node->next =
null;
node* now_node =
header;
node* temp;
while (now_node !=
null)
}int main()
單向迴圈鍊錶
單向迴圈鍊錶.cpp 定義控制台應用程式的入口點。include stdafx.h include include clinklist.h using namespace std int tmain int argc,tchar argv int n 5 測試空鍊錶 clinklistclist a...
迴圈單向鍊錶
typedef struct list list 初始化乙個迴圈單向鍊錶 void list init list head 判斷鍊錶是否為空 int is list empty list head 往迴圈單向鍊錶中插入乙個元素 prev 在prev元素後面插入 void list insert li...
單向鍊錶迴圈
include include include include includetypedef struct looplink looplink,plooplink 設定結點物件,包含兩個成員,nvalue和指向下乙個物件的指標pnext plooplink create phead nvalue 9...