hey dudes pls help me on this. My program is crashing on the following piece of code
When i make 1 recurssive function to work, the program works without crashing. So I would really need help in spotting the mistake I have done.
Incase if you want to know what im trying to do-
I have wrote a function to spot all pixels of an image and it is used to find the centre of the image. Some variables like pixtot and xt are declared as global variables.
void neighbour(int x, int y){
if(s[y][x+1]<192){
xt=xt+(x+1);
neighbour((x+1),y);
pixtot++;
}
if(s[y][x-1]<192){
xt=xt+(x-1);
//neighbour((x-1),y); //<- crashes when comment slashes are taken out
pixtot++;
}
if(s[y+1][x]<192){
yt=yt+(y+1);
//neighbour(x,(y+1)); //<- crashes when comment slashes are taken out
pixtot++;
}
if(s[y-1][x]<192){
yt=yt+(y-1);
//neighbour(x,(y-1)); //<- crashes when comment slashes are taken out
pixtot++;
}
}
}
Thanks