I am getting compile error
C:\Dev-Cpp\Myproj\array.cpp cannot convert 'int (*)[3]' to 'int*' for argument '1' to 'int GetValues(int*)'
at the lines indicated in Red.
#include <cstdlib>
#include <iostream>
#define MAX 3
#define MIN 0
using namespace std;
//int a[MAX][MAX];
int i,j;
int Display(int *a) {
int n=2;
for (i=MIN; i<MAX; i++) {
for (j=MIN; j<MAX; j++) {
// cout << a[i][j] << " ";
cout << *(a+ n*i+j) << " ";
}
}
return EXIT_SUCCESS;
}
int GetValues (int *a) {
int n=2;
for (i= MIN; i<MAX; i++) {
for (j=MIN; j<MAX; j++) {
// cin >> a[i][j];
cin >> *(a+ n*i+j);
}
}
return EXIT_SUCCESS;
}
int main(int argc, char *argv[])
{
int a[MAX][MAX];
int dim = 2;
cout << "enter values for a : " << endl ;
GetValues(a);
Display(a);
cout<< endl;
system("PAUSE");
return EXIT_SUCCESS;
}
Thanks and Regards
Ram Sharma