Complete C Program to initialize the graph and draw a line
#include<graphics.h>
#include<conio.h>
void main()
{
int gd =DETECT: /*Detect the graph driver dynamically*/
int gm; /*for graph mode*/
initgraph (&gd,&gm,’’’); /* graph driver, graph mode and
path has to be passed as parameters. The empty path is specified means the
path will be taken dynamically after searching in the computer. Otherwise we
need to spcify the path where bgi directory is stored in the computer */
line(10,10,200,200); /* this function draws a line from
starting co-ordinates(10,10) to the target co-ordinates (200,200). These coordintes are specified in terms of pixels */
getch();
closegraph(); /* close the graph mode */
}