/* * DrawLine.c * the broken version */ extern void Plot(int x, int y); /* plots a pixel on the screen */ /* * this function draws a line on the screen between (x0,y0) and (x1,y1), * but it has a few bugs. Can you find them and fix them? */ void DrawLine(int x0, int y0, int x1, int y1) { int xmid, ymid; if(x0 == x1 && y0 == y1) return; xmid = (x0 + x1) / 2; ymid = (y0 + y1) / 2; Plot(xmid, ymid); DrawLine(x0, y0, xmid, ymid); DrawLine(xmid, ymid, x1, y1); }