Reputation: 11
I was assigned to implement a floodfill algorithm by two manners: recursive a void RFloodFill(PGM *entrada, int x, int y, unsigned char corAtual,
Upvotes: 1
Views: 148
Reputation: 225
If I understand your problem correctly, the seg fault is occurring when x = -1 and y = 0. This is because you are trying to assign a value to a negative index in the matrix which is not allowed. Since you are trying to modify a place in memory you dont have access to, it seg faults.
saida->imagem[x][y]=corAtual;
if x is negative here, it will seg fault here, as it is before the check to see if x > 0
Upvotes: 1