Friday, December 18, 2020

,

Use of clrscr function in c with example

 clrscr function in C programming is use to clear the screen and move the arrow upper left-hand corner of your computer screen.

this function work only for the GCC compiler otherwise use clear/cls command.

Example program for clrscr function in c

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

int main()
{
   printf("Press any key to clear the screen.\n");

   getch();

   clrscr();

   printf("This appears after clearing the screen.\n");
   printf("Press any key to exit...\n");

   getch();
   return 0;
}

As you can see with the help of printf function computer is asking to press any key to clear the screen and then the second message will be displayed.

0 comments:

Post a Comment