For this 2D array, I was asked to search for a number. Once found I needed to output its location. Could someone explain to me how would I find the number's index location.
for (int row = 0; row < size; row++) // May as well use the variable sent to the function
{
for (int col = 0; col < size; col++)
{
if (ar[row][col] == search)
{
count++;
cout << search << " found at array location [" << row << "]["<< col <<"]"<< endl;
}
}
}
return count;