"clrscr" function (works in Turbo C compiler only) clears the screen and move cursor to upper left hand corner of screen.
C programming code for clrscr
- int main()
- printf("Press any key to clear the screen.\n");
- printf("This appears after clearing the screen.\n");
- printf("Press any key to exit...\n");
- return 0;
In the program first we display the message "Press any key to clear the screen." using printf and then ask the user to press a key. When user will press a key screen will be cleared and another message will be printed. clrscr function does not work in Dev C++ compiler. Also do not use clrscr in graphics mode instead use cleardevice.