I can’t understand why I get the run time error:
the variable ia is being used without being initialized.
However, as far as I can see, I have initialized it.
#include <iostream>
using namespace std;
int main()
{
//array dimensions
const int row_size = 2;
const int col_size = 4;
//array definition
int ia[row_size][col_size] = {{0, 1, 2, 3},{5, 6, 7, 8}};
cout << ia[2][4];
system("PAUSE");
return 0;
}
C++ array indexes are zero-based. So to access the fourth column of the second row, you need to access
ia[1][3].