Function "clrscr" (works in Turbo C++ compiler only) clears the screen and moves the cursor to the upper left-hand corner of the screen. If you are using the GCC compiler, use system function to execute the clear/cls command.
C programming code for clrscr
printf("Press any key to clear the screen.\n");
printf("This appears after clearing the screen.\n");
printf("Press any key to exit...\n");
In the program, we display the message (Press any key to clear the screen) using printf and ask the user to press a key. When the user presses a key screen will be cleared and another message will be printed. Function clrscr doesn't work in Dev C++ compiler. Use the cleardevice function instead of clrscr in graphics mode.
Clear screen in C without using clrscr
printf("Press any key to clear the screen\n");
system("clear"); // For Windows use system("cls");