我不断收到错误消息:“运行时检查失败 #3 - 正在使用变量‘x’而未初始化。”
我以为我用放入数组中的所有数字对其进行了初始化?
#include <iostream>
using namespace std;
const int MAX = 10;
int odd(int sumOdd[])
{
int sum = 0;
for(int i = 0; i < MAX; i ++)
{
if(sumOdd[i] % 2 != 0)
sum+=sumOdd[i];
}
cout << "Sum of odd integers in the array: " << sum << endl;
return sum;
}
int main()
{
int x[MAX] = {13,14,8,7,45,89,22,18,6,10};
int returnArray(x[MAX]);
cout << "Sum of odd integers in the array" << endl;
system("pause");
return 0;
}