434,587 Members | 1,071 Online
Need help? Post your question and get tips & solutions from a community of 434,587 IT Pros & Developers. It's quick & easy.

# how does the recursion in the code is actually working

 P: 28 heres a code for boundary filling my doubt is how the control is going from one fill_right function to other Expand|Select|Wrap|Line Numbers #include #include #include #include   void fill_right(x,y) int x , y ; { if((getpixel(x,y) != WHITE)&&(getpixel(x,y) != RED)) { putpixel(x,y,RED); fill_right(++x,y); delay(1); x = x - 1 ; fill_right(x,y-1); fill_right(x,y+1); } delay(1); }     void fill_left(x,y) int x , y ; { if((getpixel(x,y) != WHITE)&&(getpixel(x,y) != RED)) { putpixel(x,y,RED);   fill_left(--x,y); x = x + 1 ; fill_left(x,y-1); fill_left(x,y+1); } delay(1); }     void main() { int x,y,n,i; int gd=DETECT,gm; clrscr();   initgraph(&gd,&gm,"c:\\tc\\bgi");       /*- draw object -*/   line (50,50,200,50); line (200,50,200,100); line (200,100,50,100); line (50,100,50,50);   /*- set seed point -*/ x = 125; y = 75;   fill_right(x,y); fill_left(x-1,y);   getch(); }     please help me......thanks a lot Oct 18 '10 #1