Basic Question - Find "ArrayMinimum" in a multiline array

 

If I'm working with "multiline" array and I would like to search the minimum value of a specific columm.

How can I do that?

Code example:

double  test[4][6];

   for(int z=0; z<6 ; z++)
      for(int i=0 ; i<4 ; i++)
         {
          test[i][z]=i+z+1;
         }
   
   test[0][1]=8;
   
   ArrayPrint(test);

Code Result:



So, I would like to return the Line number of the minimum value of the second columm.

The result should be line 1 and the value = 3.

 
Guilherme Mendonca: How can I do that?

You code it.

Is that so hard you couldn't do it?

double smallest=DBL_MAX; int iSmallest=EMPTY;
for(int i=0; i < 4; ++i){
  double v=test[i,2];
  if(v < smallest){ smallest=v; iSmallest=i; }
}
Is that so hard you couldn't do it?
 
William Roeder #:

You code it.

Is that so hard you couldn't do it?

Is that so hard you couldn't do it?

Thanks William!

Sometimes we have the answer in front our nose and could not see it