Table of Content

clrscr function >> conio.h Header file >> Library Functions in C Programming



clrscr function >> conio.h Header file >> Library Functions in C Programming


What it does :

  1. clears window screen in text mode
  2. Place the cursor at Position upper left hand corner (1,1)
  3. Header File : conio.h
#include<stdio.h>
#include<conio.h>
 int main(void)
 {
    int i;
    // Prints 20 numbers 
    for (i = 0; i < 20; i++)
       printf("%d\n", i);
    printf("\r\nPress any key to clear screen");
    getch();
    clrscr();  // Clears the screen
    printf("The screen has been cleared!");
    getch();
 }

Output :

The screen has been cleared!