[問題] 二維陣列輸入 新手問題(已經解決)

看板C_and_CPP (C/C++)作者 (崧樓下的腳印)時間8年前 (2017/06/03 22:02), 8年前編輯推噓1(102)
留言3則, 2人參與, 最新討論串1/1
開發平台(Platform):W7 編譯器:Dev c++ 額外使用到的函數庫(Library Used): (Ex: OpenGL, ...) 問題(Question): 二維陣列輸入 輸出: 新手自學,依照書本上的進行,但輸出卻是亂數@@! 檢查不出來為什麼QQ 餵入的資料(Input): 輸入 1,2,3,4,5,6 預期的正確結果(Expected Output): 輸出 1,2,3 4,5,5 錯誤結果(Wrong Output): 一串數字 http://imgur.com/E5BUR2q.jpg
程式碼(Code): 好讀圖片:http://imgur.com/slji3QZ.jpg
#include <stdio.h> #include <stdlib.h> #define CLASS 2 #define STUDENT 3 int main(){ int score[CLASS][STUDENT]; int i,j; for (i=0;i<CLASS;i++){ for(j=0;j<STUDENT;j++){ scanf("%d",&score[i][j]); } } for (i=0;i<CLASS;i++){ for(j=0;j<STUDENT;j++){ printf("%d",&score[i][j]); } } return 0; } 補充說明(Supplement): 我即使把輸入改掉,直接餵資料 int score[2][3]={1,2,3,4,5,6} 輸出也是亂數,不知道為什麼 新手上路,如果問題太笨請多包涵 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 114.24.54.165 ※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1496498520.A.3D0.html

06/03 22:04, , 1F
scanf("%d",&score[i][j]);
06/03 22:04, 1F

06/03 22:04, , 2F
printf("%d",&score[i][j]);
06/03 22:04, 2F
謝謝C大提醒 抱歉傳錯圖檔 已修正常正確I J版 但仍是找不到錯誤 QQ

06/03 22:17, , 3F
&
06/03 22:17, 3F
謝謝 g大 原來又錯在 &這種笨地方 也謝謝C大介紹給我http://codepad.org/ 這網站 超感激 ※ 編輯: a855341 (114.24.54.165), 06/03/2017 22:29:38
文章代碼(AID): #1PCi5OFG (C_and_CPP)
文章代碼(AID): #1PCi5OFG (C_and_CPP)