How to clear screen in C Language

We can clear screen in C language according to the compiler.

  1. Using clrscr() - For TurboC Compiler
  2. Using system("cls") - For gcc/g++ & TurboC Compiler windows
  3. Using system("clear") - For gcc/g++ compiler in Linux
/* TurboC Compiler */ #include <stdio.h> #include <conio.h> /*for clrscr()*/ int main(){ int num=100; /*Use after declaration section*/ clrscr(); /*clear output screen*/ printf("value of num: %d\n",num); return 0; } /* GCC compiler and TurboC Compiler For Windows */ #include <stdio.h> #include <stdlib.h> /*for system()*/ int main(){ int num=100; /*Use after declaration section*/ printf("Not display due to clearscr"); system("cls"); /*clear output screen*/ printf("value of num: %d\n",num); return 0; } /* gcc/g++ compiler Linux */ #include <stdio.h> #include <stdlib.h> /*for system()*/ int main(){ int num=100; /*Use after declaration section*/ system("clear"); /*clear output screen*/ printf("value of num: %d\n",num); return 0; }

agyanadda

Author & Editor

Has laoreet percipitur ad. Vide interesset in mei, no his legimus verterem. Et nostrum imperdiet appellantur usu, mnesarchum referrentur id vim.

1 $type={blogger}:

  1. Slots Casino Review | Safe or Scam?
    Read our full 포커 에이스 review 슬롯 머신 of this Casino Online in Mexico in 2021, 바카라 추천 what bonuses it offers and how to play them. Find out 네이버 룰렛 which 도박사이트 are worth playing.

    ReplyDelete