Hello,
I've writing a function to find the three largest integers in a 3rd dimensional array which has #0 to 9 stored exclusively. However, I keep getting the same highest # (usually 9) stored in max_store[]. I have tried everything, and I don't know where to go next. If some one could please offer me some help, I'd really appreciate it. I need this asap. Thank you so much.
JustinCode:void find_max(int fun[ROW][COL][LAYER]) { int num, r, c, l, k; int max=0; int max_store[3]={-1}; for (num=0; num < 3; num++) { for (r=0; r < ROW; r++) { for (c=0; c < COL; c++) { for (l=0; l < LAYER; l++) { for (k=0; k < 3; k++) { if (max < fun[r][c][l] && max_store[k] != max) max = fun[r][c][l]; } } } } max_store[num] = max; max = 0; }
P.S. If you want to look at entire source file, I attached it to this thread.



LinkBack URL
About LinkBacks


