看板 C_and_CPP 關於我們 聯絡資訊
開發平台(Platform): (Ex: Win10, Linux, ...) Linux 編譯器(Ex: GCC, clang, VC++...)+目標環境(跟開發平台不同的話需列出) gcc 問題(Question): 各位大神大家好,小弟正在做資料結構的作業,因為就教授要求必須用二為維動態陣列, 但是遇到一些錯誤狀況,在delete的時候會跑出錯誤狀況: Error:free(): invalid next size(fast) 餵入的資料(Input): n 為 欲排列的個數 amax amin 為產生隨機變數區間 rseed 為種子 預期的正確結果(Expected Output): 錯誤結果(Wrong Output): Error:free(): invalid next size(fast) 程式碼(Code):(請善用置底文網頁, 記得排版,禁止使用圖檔) https://ideone.com/GIdoRv 補充說明(Supplement): -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 1.173.139.63 ※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1545846887.A.BB1.html
ggBird: new迴圈從0開始,delete迴圈要<n,而且只配一個row, 要 <1 12/27 08:36
school4303: 你的new為什麼是從i=1開始? 12/27 08:40
hare1039: 不用 new 就不用 delete 了,善用 std::vector 12/27 21:34
poyenc: xD 你需要先把 insertion sort 寫好再來挑戰 merge sort 12/28 02:18