line() function

line function is used to draw a line from a point(x1,y1) to point(x2,y2) i.e. (x1,y1) and (x2,y2) are end points of the line. The code given below draws a line.

Declaration of line() function

void line(int x1, int y1, int x2, int y2);

C programming code for line 

#include<graphics.h> 
#include<conio.h>
main()
{
int gd = DETECT, gm;
initgraph(&gd, &gm, "C:\\ TurboC3\\BGI");
line(100, 100, 200, 200);
getch(); 
closegraph(); 
return 0;
}