The draw function

When the draw function is called in Listing 2:

A pointer to the off-screen buffer is also passed to the draw function.

The draw function is shown in its entirety in Listing 5.

Listing 5. The draw function.
void draw(int xCoor,int yCoor,BITMAP* buf,int color){
  show_mouse(NULL);//hide mouse pointer while drawing
  
  //Draw filled circle at mouse coor on off-screen buffer.
  circlefill(buf,xCoor,yCoor,5,color);
  //Copy the off-screen image to the screen.
  blit(buf,screen,0,0,0,0,440,500);
  
  show_mouse(screen);//show mouse when drawing finished
}//end draw