链表 · 节点串联与遍历
节点 = 数据域 + next 指针 · 从 head 出发,沿 next 逐个走到 nullptr
head
头指针
10
•
data
next
22
•
data
next
27
•
data
next
nullptr
链尾 · 遍历停止
数据域
指针域 next
p
游标
linkNode *p = head;
while (p) {
cout << p->data;
p = p->next;
}
cout 输出
p 前进,head 不动
▶ 重播