ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel
  • »
  • Technology»
  • Computers & Software

Explaining :- clrscr (); and getch(); in C

Updated on June 22, 2012

clrscr (); and getch();

clrscr(); and getch(); requires the header file conio.h i.e #include <conio.h>

clrscr(); :- This is used for clearing the output screen i.e console

suppose you run a program, alter it and run it again you may find that the previous output is still stuck there itself, at this time clrscr(); would clean the previous screen.

One more thing to remember always use clrscr(); after the declaration like

int a,b,c;

float total;

clrscr();

getch(); :- getch is used to hold the screen in simple language, if u don't write this the screen

will just flash and go away....

Comments

    0 of 8192 characters used
    Post Comment

    • profile image

      madhuri 14 months ago

      This was really in very simple language.Thank u sir....

    • profile image

      p.meena 20 months ago

      Thank you sir.

    • profile image

      ganesh kumar 2 years ago

      correct ans

    • profile image

      tania sarkar 2 years ago

      Thnk u so much.....

    • profile image

      pranav 2 years ago

      thanks man

    • profile image

      Ivan 2 years ago

      Thank you man, best regards.

    • profile image

      mukesh mahato 2 years ago

      Thank you so much

    • profile image

      saqi gujjar 2 years ago

      its very easy to solve problems

    • profile image

      Yash singhal 3 years ago

      Really its great for studying.........

    • profile image

      veer 3 years ago

      This helps me lot to understanding the program

    • profile image

      sasi 3 years ago

      Its useful

    • profile image

      kannan 3 years ago

      u r good expliner

    • profile image

      rajini 3 years ago

      Its useful

    • profile image

      sky 3 years ago

      thanx

    • profile image

      yar muhammad 3 years ago

      Thanks of your well explanation

      I have understood perfectly

    • profile image

      sha 3 years ago

      good expanation

      thank you

    • profile image

      jeyanthan 3 years ago

      i need a help i just installed c++ setup from yogisoft tec., in that the display screen is not clear and numbers are hidden how can i rectify it and where can i gertt original turbo c setup

    • profile image

      Praveen 3 years ago

      Thanks

      its very helpful

    • profile image

      BHaradwaj 3 years ago

      Thanks , Its correct way u explained

    • profile image

      CoderGal 3 years ago

      Compact, to the point, and solves my problem

    • profile image

      S.Kothandaraman 3 years ago

      Thank u very much for the insant response in proving information.

    • profile image

      saawan kumar 4 years ago

      clrscr();-clrscr function clears the screen

    • profile image

      mani kanth 4 years ago

      thanx a lot bro.....

    • profile image

      Muhammad Asif Raza 4 years ago

      It's very helpful ...Thanks to all

    • profile image

      sonu 4 years ago

      good explanation

    • profile image

      Devi 4 years ago

      Thank you

    • profile image

      anbu 4 years ago

      fastastic

    • profile image

      ajay dhakar 5 years ago

      its fantastic

    • profile image

      ganapthihema 5 years ago

      very simple and nice definition

    • profile image

      kamal sharma 5 years ago

      I were very confuse that how does declare both now I could able to use right way of clrscr(); and getch();

      Thanks

    • profile image

      sumit paul 5 years ago

      thanks......

    • profile image

      Siddhartha 5 years ago

      stupendo fantabolously fantastical,chummeshwari and now that's what i call explanation..in all total many many thnx..

    • profile image

      Satish 5 years ago

      thanks....

    • profile image

      ARVIND KUMAR 5 years ago

      superb

    • profile image

      nomi 5 years ago

      i did it but it asks to declare clrscr();????

    • profile image

      DoNa 5 years ago

      Thank u ..........

    • profile image

      Raghvendra singh 5 years ago

      thanks you solve the problem

    • profile image

      Marwan 5 years ago

      thanks you

    • profile image

      Rizwan 5 years ago

      Very Good Ans...

    • profile image

      pratima 5 years ago

      even if we does not give conio.h stil clrscr() works..

      why??

      den what is the need of that header file

    • profile image

      sathishkumar 6 years ago

      thanks.nice explanation

    • profile image

      tiii 6 years ago

      nice explanation................ thanx.......

    • profile image

      uv ramana 6 years ago

      Thanks and its very useful for me.

    • profile image

      mithilesh kumar 6 years ago

      can we use clrscr anywhere in the program? If we use then what will be the result?

    • profile image

      Priyanka 6 years ago

      How we pass 2-D Array to a Function?

    • profile image

      chaitra 6 years ago

      wow!gud explaination thanks lot

    • profile image

      sanjeev 6 years ago

      thanks a lot

    • profile image

      Pworld 6 years ago

      the clrscr() is declared after declaration of variable becoz of the structure format of c..dat is the main function 1stly searches d declaration of variable den other fun. hence it gives error when declared be4..hope dis help

    • profile image

      punit chauhan 6 years ago

      surely it'll help me..........

    • profile image

      joydeep 6 years ago

      thanks a lot......

    • profile image

      ravi256690 6 years ago

      why we cant use clrscr() before declaration?

    • profile image

      Anirudh Banerji 6 years ago

      Does anyone knows that if we do not clear the console, then the previous outputs get displayed every time we run it,So i wanted to know where are these previous output are stored. Exactly which place holds these output on the console?

      Thank you

    • profile image

      iqra 6 years ago

      hye want 2 learn c language in detail online plz help me.wat should i have 2 do.bcoz i dnt understand frm my teacher

    • profile image

      sonali 6 years ago

      thanks a lot

    • profile image

      oindo job 6 years ago

      its been really useful...

    • profile image

      khairy 7 years ago

      rencylL:

      One of my fellow asked about the abbreviation of conio.

      So, it is console input out. Oh, i remembered, this thing my professor told me in Intro to computer programming. Well, helped me.

    • profile image

      Khairy 7 years ago

      i am using visual Studio6. Clrscr(); not working. It says , undeclared. Even, as u said, make use of coni.h. I did even then, not working.

    • profile image

      praveen 7 years ago

      thanks 4 well explanation of clrscr();

    • profile image

      Fadila Fulail 7 years ago

      Hmm well explained in the way that i want, thank you

    • profile image

      sourabh.... 7 years ago

      thnx...it works correctly nw..

    • profile image

      gaurav 7 years ago

      well explained

    • profile image

      bala 7 years ago

      useful info

    • profile image

      piyapiya 7 years ago

      visual studio 2008 is a compiler itself..how?? please anybody explain me about compiler..

    • profile image

      piyapiya 7 years ago

      nice explanation from every one and thanks to you all people. actaully, i am new one from c++ using visual studio 2008.. and i saw many projects with clscr() and getch(). so i was confused but now clear to some extent.

    • profile image

      Ashley 7 years ago

      what will happen if i use clrscr() before the declaration...it comes error but i want to know why

    • profile image

      ryan 7 years ago

      how to color the output!

    • profile image

      suresh 7 years ago

      i want some programs,quizzes in c where i can found them

    • profile image

      Anand Pardeshi 7 years ago

      why we have to use clrscr() after the variable declaration.

    • profile image

      vikas 7 years ago

      thanks a lot .. well explained

    • profile image

      payal 7 years ago

      hi.....nice explaination but plz tell me the reason to declare clrscr after variable declaration ????

    • profile image

      dixy 7 years ago

      thank u

    • priyankmaniar profile image
      Author

      Priyank 7 years ago from Mumbai, India

      thankyou everyone for your comments and appreciation.

      I have only used Turbo C as IDE for C and C++ so don't know about the other IDE's. And that does require clrscr and getch :)

    • profile image

      cath 7 years ago

      cause turbo the one only recquired a clrscr(); function...

    • profile image

      ramchandar 7 years ago

      this is useful site

    • profile image

      Ahsan 7 years ago

      Dev Cpp does not required clrscr() function. it only works with Turbo.

    • profile image

      Arjit 7 years ago

      Hi there!

      I use Dev Cpp IDE for learning C as Turbo aint working on Win Vista. So, it displays error whenever I use clrscr() and getch(). Plz help. DEV cpp is available under free license.

    • profile image

      Rohit 7 years ago

      Thanks.....

    • profile image

      Preetha 7 years ago

      good explaination

    • profile image

      kim d. 7 years ago

      nice dowd .

      now i knew it .

      it just a simple explanation .

      ur the men dowd .

    • profile image

      rencylL 7 years ago

      ty..

      ahm can you try explaning about what do in the program?,what is the defination of conio.h?

    • profile image

      tintin 7 years ago

      thanks

    • priyankmaniar profile image
      Author

      Priyank 7 years ago from Mumbai, India

      :)

    • profile image

      kishram 7 years ago

      good explaination dude...........

    • priyankmaniar profile image
      Author

      Priyank 7 years ago from Mumbai, India

      no problem guys ... thanks for commenting :)

      Cheers !

    • profile image

      Brundaban 7 years ago

      Thank a lot sir

    • profile image

      azher 7 years ago

      thanx for the great information

    • profile image

      xyz 7 years ago

      pl. note that this explanation hold water only if u r doing programing in turbo c.

    • profile image

      rimi 7 years ago

      thanks,

      it is really useful

    • profile image

      REAl 8 years ago

      Thanks man.

    • priyankmaniar profile image
      Author

      Priyank 8 years ago from Mumbai, India

      :)

    • profile image

      alam 8 years ago

      thanks brother i was forget it.

    • nicomp profile image

      nicomp really 8 years ago from Ohio, USA

      Good explanation; also note that conio.h is not ANSI or ISO standard.

    • priyankmaniar profile image
      Author

      Priyank 8 years ago from Mumbai, India

      i hope it helps. . !