if (tabela[i][j]==zamenjat) return 0; if (tabela[i][j]==trenutni) { tabela[i][j]=zamenjat; if (tabela[i][j+1]==1) { return 7; } else { flood(i+1,j,trenutni,zamenjat,visina,sirina,tabela); flood(i-1,j,trenutni,zamenjat,visina,sirina,tabela); flood(i,j+1,trenutni,zamenjat,visina,sirina,tabela); flood(i,j-1,trenutni,zamenjat,visina,sirina,tabela); } } return 0;
This is what it looks like, first it checks if its the same, if its not it checks if its the one im looking for and not 1, then the if statement which i use to change the area, and then color in all directions, but what happens is, it apparently never reaches a 1, and just colors everything in the same color