習題11 7 奇數值結點鍊錶 20分

2021-10-03 07:52:12 字數 432 閱讀 8205

本題要求實現兩個函式,分別將讀入的資料儲存為單鏈表、將鍊錶中奇數值的結點重新組成乙個新的鍊錶。鍊錶結點定義如下:

這題最後題目要返回新的鍊錶的頭結點,但是編譯錯誤,返回首元節點則對,不知道為什麼。

struct listnode 

;

struct listnode *

readlist()

return head;

}struct listnode *

getodd

(struct listnode *

*l )

else

p=p->next;}(

*l)=

(*l)

->next;

return head->next;

}

習題11 7 奇數值結點鍊錶 20 分

本題要求實現兩個函式,分別將讀入的資料儲存為單鏈表 將鍊錶中奇數值的結點重新組成乙個新的鍊錶。鍊錶結點定義如下 struct listnode 函式介面定義 struct listnode readlist struct listnode getodd struct listnode l 函式rea...

習題11 7 奇數值結點鍊錶 20分

無頭節點 本題答案 無頭節點 本題答案 struct listnode readlist return head 返回頭節點 有了頭 就可以輸出下面所有的資料 struct listnode getodd struct listnode l 二級指標?else head1 q p1 q p1存奇數 ...

習題11 7 奇數值結點鍊錶 20分

本題要求實現兩個函式,分別將讀入的資料儲存為單鏈表 將鍊錶中奇數值的結點重新組成乙個新的鍊錶。鍊錶結點定義如下 struct listnode readlist struct listnode getodd struct listnode l 函式readlist從標準輸入讀入一系列正整數,按照讀入...