lineto() function in C
The header file graphics.h contains lineto() function which draws a line from current position to the point(x,y).
Note : Use getx() and gety() to get the current position.
lineto(int x, int y); where, (x, y) are the coordinates upto which the line will be drawn from previous point.
CASE 1 : When the initial position of point is (0,0)
Below is the implementation of lineto() function with initial position at origin :
CASE 2 : When the initial position of point is not (0, 0)
Below is the implementation of lineto() function with initial position other than origin :