putpixel() function

putpixel function plots a pixel at location (x, y) of specified color.

Declaration of putpixel() function

void putpixel(int x, int y, int color);

For example if we want to draw a GREEN color pixel at (35, 45) then we will write putpixel(35, 35, GREEN); in our c program, putpixel function can be used to draw circles, lines and ellipses using various algorithms.

C programming code for putpixel()

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