Hi, i have to create a algorithm called find2D, to find an element x in an n × n array A. The find2D function iterates over the rows of A, and it calls the algorithm findArray shown below, on each one, until x is found or it has searched all rows of A.
int findArray(int A[], int n, int x)
{
for(int i = 0; i < n; i++)
if(A[i] == x)
return i;
else
return -1;
}
This function has to be called in find2D i am not sure how to pass this function to find2D to check each row