Hello.

I am trying to write a recursive function

void check_array(int array1[][M],int row,int col,int array1[row][col]);

(it might have to be an int function in the end)

The object of this function is check what number is in array1[row][col] and to printf how many similar neighbors it has.

for example:

Code:

4 3 2 3 1
5 3 3 2 2
1 1 3 3 2
1 3 3 2 4
5 5 3 4 4

if function is called with 2,2 then the number is 3 and it has 9 connected 3's

if function is called with 4,4 then the number is 4 and it has 3 connected 4's (the extra 4 in the array is not adjacent)

Now the catch is I need to do it recursively. Do you have any advice on how to approach the problem? I could use a helper sub-function if need be, I jsut have no idea how to approach this.

Thank you