Function lineto draws a line from the current position (CP) to the point (x, y), you can get current position using getx and gety function.
C programming code for lineto
#include <graphics.h>
#include <conio.h>
#include <conio.h>
int main()
{
int gd = DETECT, gm;
initgraph(&gd, &gm, "C:\\TC\\BGI");
moveto(100, 100);
lineto(200, 200);
getch();
closegraph();
return 0;
}