0
掃描arr函數問題。二維陣列掃描崩潰
void scan_arr(double ar[3][5]) // Declares that it is a 3 x 5
{
int x;
int y;
printf("Enter arrays of 3x5\n");
for(x = 0; x < 3; x++) // Shows that this loop shall be done 3 times
{
for(y = 0; y < 5; y++) // Shows that 5 times * the number of the first loop
{
scanf("%lf",ar[x][y]); // Scans @ x * y and terminates after first input
}
}
}
Riiiight!我覺得很愚蠢:)。那麼我想每個人都可以在編程學習中犯這樣一個簡單的錯誤。 – user2354897 2013-05-07 18:55:04
@ user2354897當然,這是一個非常常見的錯誤。即使是有經驗的程序員也會時不時的,因爲編譯器無法檢測到它。如果修復程序適用於您,請考慮通過單擊旁邊的複選標記來接受答案。這會讓其他人知道你不再需要積極尋找改進的答案,並在堆棧溢出中贏得徽章。 – dasblinkenlight 2013-05-07 18:58:07