Given a double array of random values mod 5 and a value X and a position in the array, I have to change the position's value and all its neighbors to X. I'm doing it recursively. I think the idea is correct, however I must be messing with the return statement and the assignment using the recursive call. When compiling I get note: expected 'int **' but argument is of type 'int (*)[8]'
also, if I use the function in the main I get warning: passing argument 1 of 'floodfill' from incompatible pointer type table = floodfill( table, i, j, r );
error: assignment to expression with array type table = floodfill( table, i, j, r );
where table is the table on which the algorithm has to be executed
int ** floodfill ( int **tab, int i, int j, int v)
{
/*if statement to make the values to the right of the specified position
equal to the specified value*/
if ( tab[i][j+1] == tab[i][j] )
{
/*the assignment is recursive*/
tab = floodfill ( tab, i, j+1, v);
}
/*this assignment is executed after each of the values to the
right of tab[i][j] are changed to v*/
tab[i][j] = v;
/*returns the tab with the specified position changed*/
return tab;
}
Obviously the code is incomplete (no malloc, no check for out-of-bound position and only floodfill of right values) for the sake of brevity , but for what concerns my problem there should be everything.