int findMax( int nrows, int ncols, int x[nrows][ncols] )
{
int max = x[0][0];
int r, c;
for ( r=0; r<nrows; r++ )
{
for ( c=0; c<ncols; c++ )
if ( x[r][c] > max ) max = x[r][c] ;
}
return max;
}
Inspect the initialization of max.
Reflect on how initializing it to zero would not always work.