-1
int main() //task 10
{
int num[9], i, counter = 0, minNum, maxNum = 0, sum = 0;
for (i = 0; i <= 9; ++i)
{
scanf("%d", &num[i]);
if (num[i] > maxNum)
{
maxNum = num[i];
minNum = maxNum;
}
else if (num[i] < minNum)
minNum = num[i];
sum += num[i];
}
printf("minNum: %d, maxNum: %d\nThe average is:%d\n", minNum, maxNum, sum/10);
return 0;
}
陣列試圖運行這個節目,我得到這個錯誤: 運行時檢查失敗#2 - 圍繞堆棧變量「民」已損壞。 我想知道我的數組有什麼問題。下面你錯誤,而通過在C
'int num [9]' - >'int num [10]'。還'minNum = maxNum;'?? – BLUEPIXY