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

作者: a855341 (崧樓下的腳印)   2017-06-03 22:01:48
開發平台(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}
輸出也是亂數,不知道為什麼
新手上路,如果問題太笨請多包涵
作者: cutekid (可愛小孩子)   2017-06-03 22:04:00
scanf("%d",&score[i][j]);printf("%d",&score[i][j]);
作者: grayStone (灰色石頭)   2017-06-03 22:17:00
&

Links booklink

Contact Us: admin [ a t ] ucptt.com