?? 2.14.c
字號:
2.14② 試寫一算法在帶頭結點的單鏈表結構上實現線性表
操作Length(L)。
實現下列函數:
int Length(LinkList L);
// Return the length of the linked list
// whose head node is pointed by 'L'
單鏈表類型定義如下:
typedef struct LNode{
ElemType data;
struct LNode *next;
} LNode, *LinkList;
int Length(LinkList L)
// Return the length of the linked list
// whose head node is pointed by 'L'
{
LinkList p;
int k;
for(k=0,p=L;p->next;p=p->next,k++);
return k;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -