[問題] LinkedList實作無法連結

看板C_and_CPP作者 (高毛毛)時間6年前 (2017/10/08 02:44), 編輯推噓1(103)
留言4則, 2人參與, 6年前最新討論串1/1
開發平台(Platform): (Ex: Win10, Linux, ...) Win10 編譯器(Ex: GCC, clang, VC++...)+目標環境(跟開發平台不同的話需列出) VC2015 額外使用到的函數庫(Library Used): (Ex: OpenGL, ...) none 問題(Question): 設計方法是利用Node物件 包含一個紀錄值(int) 及 指向下個 Node 的 Node*指標 Node有Get 及設定下一個節點的方法。 在List中InsertNode裡面使用LinkedNode無法有效連接下一節點。 餵入的資料(Input): Node pNode(1); Node pNode2(2); Node pNode3(3); 預期的正確結果(Expected Output): 1 2 3 錯誤結果(Wrong Output): nullptr 程式碼(Code):(請善用置底文網頁, 記得排版) https://github.com/CJayKao/LinkedList- 補充說明(Supplement): 卡在無法把Node中*Node nextNode無法指向正確節點。 感謝PTT板友 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 1.172.107.136 ※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1507401885.A.CBE.html

10/08 03:51, 6年前 , 1F
pRNode=fistNode->next 得到null後又對pRNode做物件操作
10/08 03:51, 1F

10/08 03:51, 6年前 , 2F
就會跳error了
10/08 03:51, 2F

10/08 20:03, 6年前 , 3F
感謝 新增一個確認 下一節點為空的方法,再將專案做修
10/08 20:03, 3F

10/08 20:03, 6年前 , 4F
10/08 20:03, 4F
文章代碼(AID): #1PsI2To- (C_and_CPP)