[問題] function call by reference的問題
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
dev-c++
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
問題(Question):
在code內,有個叫make_tree的函數,在這函數執行時會有bug
餵入的資料(Input):
預期的正確結果(Expected Output):
原本預期run完這函數就能將tree建起來
錯誤結果(Wrong Output):
結果head吃到elememt的位置之後,好像發生將位置丟掉的狀況,每次都去執行一開始
if(...)的部分
程式碼(Code):(請善用置底文網頁, 記得排版)
http://ideone.com/gaV2M
補充說明(Supplement):
我把head當作是tree的開頭位置,然後根據head是否有內容決定student_ptr的位置,
不知道這樣是錯在哪了???
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 111.251.184.186
→
02/17 00:37, , 1F
02/17 00:37, 1F
→
02/17 01:01, , 2F
02/17 01:01, 2F
→
02/17 01:06, , 3F
02/17 01:06, 3F
→
02/17 01:07, , 4F
02/17 01:07, 4F
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 2 篇):