There are two modes of computer system on which users can operate. They are as follows:

• Text Mode
• Graphics Mode

Text Mode: By default your computer system is in text mode. In text mode your computer system is divided into rows and columns. By default we have 80 X 25 numbers of rows and columns

Graphics Mode: Since we are in text mode by default to go in graphics mode we have to initialize graphics mode. In graphics mode screen is usually divided into pixels. Pixels are small point or a single unit on a screen. Pixel is acronyms of Picture Element. Here is a sample example to switch between text mode to graphics mode and vice versa.

EXAMPLE TO INITIALIZE GRAPHICS MODE

 #include<stdio.h>
 #include<conio.h>
 #include<graphics.h>
 main()
 {
     int gd, gm; //DECLARING GRAPHICS DRIVER AND GRAPHICS MODE
     detectgraph(&gd, &gm); //DETECTING GRAPHICS DRIVER AND MODE
     initgraph(&gd, &gm, " ");//INITILIZING GRAPHICS MODE
     line(0,0,200,00); //DRAWING LINE IN GRAPHICS MODE
     getch();
     closegraph(); //TERMINATING GRAPHICS MODE
 }

NOTE: It is really important to include the graphics header file in order to this to work.