while learning C i am working on multidimensional arrays.... i am trying to rite a program in C to
pick up the largest number from any 5 row by 5 column matrix
i did it in one dimension by first sorting the array and then printing the last digit of array but i am lost in multidim please help dont give me prog just need to know the logic or way plz help
You don't have to sort the array. Just do a compare inside the inner loop and compare if the current value of the array is bigger than a variable which stores a "highscore".
If it's bigger, store the array's value in the highscore variable.
E.g.:
highscore = 0; // initialize highscore with 0 for unsigned type, -xyz for signed type
(outer loop)
(inner loop)
if (array[x][y] > highscore) highscore = array[x][y]; // remember highest value
(end of inner loop)
(end of outer loop)
printf(Highest value: , %...", highscore); //... depends on type of array