0

I have the following code for DDA Line Algorithm in C :-

```
//DDA Line Algorithm
#include<stdio.h>
#include<graphics.h>
#include<conio.h>
#include<math.h>
#include<stdlib.h>
#define Round(a) ((int)(a+0.5))
void linDDA(int xa,int ya,int xb,int yb);
int main()
{
int gdriver=DETECT,gmode;
initgraph(&gdriver,&gmode,"E:\\TC\\bgi");
linDDA(10,20,200,100);
clrscr();
getch();
return 0;
}
void linDDA(int xa,int ya,int xb,int yb)
{
int dx,dy,steps,k;
float xincr,yincr,x=xa,y=ya;
dx=xb-xa;
dy=yb-ya;
if(abs(dx)>abs(dy))
steps=abs(dx);
else
steps=abs(dy);
xincr=dx/(float)steps;
yincr=dy/(float)steps;
putpixel(Round(x),Round(y),20); //plotting the first point
for(k=0;k<steps;k++)
{
x+=xincr;
y+=yincr;
putpixel(Round(x),Round(y),20);
}
}
```

The code compiles fine but in the output I get a white screen on a black background. There is no line printed in the output. Please help!!