hi all,
i am having difficulty understanding how to use 2d arrays in any of my functions...
I know how to find the max[] for any array, but when the arr[][] comes into the picture i'm getting messed up!
here's what my max function is: (my array has 4 rows, 6 cols) and the content has been inputted and printed by previous functions.
I'm not sure my function or call are correct either..
for some reason the logic is passing me, hope someone can explain.thanks, Michele
Code:
//prototype
int Maxsearch(int arr2d[][cols], int SIZE);
//call
Maxsearch(arr2d, SIZE);
//Part3 : Function definition: Largest Int & Address
int Maxsearch(int arr2d[][cols], int MAX){
outfile << "\n\n";
outfile<<setw(60)<< "Part 3 - Largest Integer & Address:" << "\n\n" << endl;
outfile<< setw(30) << endl;
MAX = arr2d[0][6];
int MAXi = 0;
for ( int i = 0; i < MAX; i++ ){
if (arr2d[i][6] > MAX){
MAX = arr2d[i][6];
MAXi = i;
}
outfile<< MAX << setw(4) << MAXi << endl;
}
return 0;
}