[問題] C語言陣列的問題
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)DEV CPP
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)stdio.h和stdlib.h
問題(Question):我寫了一個程式(程式碼如下),但是在"輸入[9][5]"之後就跳掉了
餵入的資料(Input):#include <stdio.h>
#include <stdlib.h>
int main()
{
int a, b, c;
int num[9][9];
for(a=0; a<=9; a++)
{
for(b=0; b<=9; b++)
{
printf("請輸入[%d][%d]\n", a, b);
scanf("%d", &num[a][b]);
printf("[%d][%d]=%d\n", a, b,
num[a][b]);
}
}
for(a=0; a<=3; a++)
{
for(b=0; b<=2; b++)
{
printf("[%d][%d]=%d\n", a, b, num[a][b]);
}
}
system("PAUSE");
return 0;
}
預期的正確結果(Expected Output):程式叫我輸入100個數,之後就把他們全部印在畫面上
錯誤結果(Wrong Output):在"輸入[9][5]"後又回到"輸入[9][2]"
程式碼(Code):(請善用置底文網頁, 記得排版)與上面一樣
補充說明(Supplement):
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 118.168.57.83
※ 文章網址: http://www.ptt.cc/bbs/C_and_CPP/M.1409835723.A.0FA.html
推
09/04 21:03, , 1F
09/04 21:03, 1F
推
09/04 21:04, , 2F
09/04 21:04, 2F
→
09/04 22:08, , 3F
09/04 22:08, 3F
推
09/04 22:35, , 4F
09/04 22:35, 4F