Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Help for C++ code, using selection sort for 2-D array Here is my code that I wro

ID: 3684314 • Letter: H

Question

Help for C++ code, using selection sort for 2-D array

Here is my code that I wrote so far

void selectionSort(const int array[][COLS], int ROWS) //function header ROWS = 4, COLS = 5
{

   int strtScn, minIdx, minVle;

   for (int i = 0; i < ROWS; i++)
   {
       for (int strtScn= 0; strtScn < COLS; strtScn++)
       {
           minIdx = strtScn;
           minVle = array[i][strtScn];

           for (int idx = strtScn + 1; idx < COLS; idx++)
           {
               if (array[i][idx] < minVle)
               {
                   minVle = array[i][idx];
                   minIdx = idx;
               }
           }

           array [i][minIdx] = array[i][strtScn]; // I get an error here that is telling me that expression needs to be a modifiable value
           array [i][strtScn] = minVle; // I get an error here that is telling me that expression needs to be a modifiable value
       }
   }

}

Explanation / Answer

Please check the the array is declared as const(const int array[][COLS])

that's we cannot modify the array