clrscr()

The clrsrc() function is used to clear text mode window. It clears the current text window and places the cursor in the upper left-hand corner (at position 1, 1). If you don’t use this function, you will see the previous output text written by previous program. 



Example of the clresc() function

#include<stdio.h>
#include <conio.h>

 void  main()
 {
    int i;
    clrscr();
    for( i = 0; i < 10; i++)
    printf("clrscr function test\n");
    printf("\n\nPress any key to clear screen");
    getch();

    clrscr();
    printf("The screen has been cleared!");
    getch();
 }


Output


When you press any key, you will find the below output.