2D array failure program

Hi. It's this problem for the BAC exam, and the thing is it ignores all the instructions and returns some random value. No cin>> instrunction, no nothing.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <iostream>

using namespace std;

 main ()
{
  int n,m,i,j, A[i][j];
  cin>>n;
cout<<endl;
  cin>>m;
  cout<<endl;
  for(i=2;i<=n;i++)
  {
      for(j=2;j<=m;j++)
      {
          A[i][j]=max(i,j);
      }
  }

 for(i=2;i<=n;i++)
  {
      for(j=2;j<=m;j++)
      {
          cout<<A[i][j]<<" ";
      }
      cout<<endl;
  }
return 0;}



Process returned -1073741571 (0xC00000FD) execution time : 0.170 s
Press any key to continue.
You didn't declare the size of A[i][j], or make the function max(i,j). An array cannot be defined after the program creation.
Topic archived. No new replies allowed.