Here is an example of recursion.
Slow the code down and you will begin to understand what it is doing and hopefully what recursion is all about. There are times when it is very useful, and there are times when it should be avoided like the plague.
void DrawGrid(int iteration,int x,int y,int x2,int y2)
if ((x2-x)<=1) return;
void Box(int x,int y,int x2,int y2,int color)
//Draw a box
Recursion takes up a lot of stack space since every time you call a function, a stack frame is created. Also, this function takes parameters which must be pushed/popped off of the stack which takes time as well. This function should not overflow the stack, but a function like a floodfill most certainly would. So, if stack space is not a problem and if implementing the function iteratively is overly complex then use recursion. Otherwise, go with the iterative approach. Recursion is used in fractals and is also used to generate terrain maps on the fly. The above algorithm could be altered to produce a terrain using the midpoint displacement algo.