You are here

closegraph function in c

closegraph function closes the graphics mode, deallocates all memory allocated by graphics system and restores the screen to the mode it was in before you called initgraph.

Declaration: void closegraph();

C code of closegraph

  1. #include<graphics.h>
  2. #include<conio.h>
  3.  
  4. main()
  5. {
  6.    int gd = DETECT, gm;
  7.    
  8.    initgraph(&gd, &gm, "C:\\TC\\BGI");
  9.    
  10.    outtext("Press any key to close the graphics mode...");
  11.    
  12.    getch();
  13.    closegraph();
  14.    return 0;
  15. }