UrbanPro

Learn C Language from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

What is the use of getch(); in the end of c program

Asked by Last Modified  

Follow 5
Answer

Please enter your answer

Computer Geek

getch() is used to hold the console(output) window on the screen after the whole program run is completed till the user enters a key from keyboard. However, the character entered is not displayed on screen. For that you will have to use getche() function. Both functions are present in conio.h header...
Comments

Computer Programmer

getch() is used to hold the screen.It makes sure that you can see your output on the output screen.If you don't use getch() at the end of your c program then you won't be able to see the output of your program.
Comments

Professional Tutor with 15 years of experience.

Most of the c program end with this statement. So most of the people thought that this program is used to get output on the screen. But it is wrong This statement is used to read a single character from console without an echo to screen.. let see how it is.... When you run this...
read more
Most of the c program end with this statement. So most of the people thought that this program is used to get output on the screen. But it is wrong This statement is used to read a single character from console without an echo to screen.. let see how it is.... When you run this program using turbo c++ compiler we cannot see the output. Actually the out put was already printed on the screen , at the printing time itself the run window will close. When you go to the user screen (window --> user screen) , you can always see what the last status of program running. Here getch() helps to the user for waiting to enter a character from keyboard .. read less
Comments

Software Project Freelancer, Trainer

This function is used to get a character from your console like scanf.. Reason for using @ end of every program: normally your c program executes line by line. Your console window(where we see our output) will appear of scanf to get our input values.. also for writng our output in printf console...
read more
This function is used to get a character from your console like scanf.. Reason for using @ end of every program: normally your c program executes line by line. Your console window(where we see our output) will appear of scanf to get our input values.. also for writng our output in printf console willopen. See the console will not wait and show the final result(after executing final line of code). It completed or executed all the lines of code , so it will terminated. So if you are using this getch() at end of code, the console window will wait for getting input from you. So tht we can check the final ouput(provided you added getch at last line). Instead just use scanf() to read any value, thepurpose is to make console open untill we wish to close. Hope it helps..! read less
Comments

to read a character from screen.
Comments

Java Expert (Oracle Certified)

getch() is to get character. It waits to get a character in input from console. So apparently it is used to hold the screen so you can see the output. This can be used anywhere you want to get any character input from console.
Comments

Computer Languages Tutor

getch() is a library function which ask for a character to continue as whenever u pas getch() in your program it will wait on the same screen untill u pass a character to that
Comments

Tutor

It is hold the output result till press any key
Comments

We use getch() to: Get information from the program Clear console screen Show console screen Close the program
read more

We use getch() to:

  • Get information from the program
  • Clear console screen
  • Show console screen
  • Close the program
read less
1 Comments

Expert C/C++ Trainer with over 15 years of Experience

If you don't use getch , the control comes back to program editor window and we need to press alt+f5 to see output screen. To avoid this we use getch to make sure the program waits till you see result and press a key. It is not a good practice to use getch.
Comments

View 23 more Answers

Related Questions

Can you suggest me some books for learning C?
"letus c" for c programming yashwant kanetkar
Yamun
Is it necessary for a programmer to start his career by learning the C language first?
no, but c is the basic if u have good analysing skills need to learn if u learn c , you can easy to get the c++ else u have put some effort on this session f c++
Shilpa
How do I learn C programming by videos or books?
BOOKS AND PRACTICE by far remain the best way for learning any language ....
Fgrefg
0 0
7
How can a program be made to print the line number where an error occurs?
int print_document(char* doc_name, int destination) { switch (destination) { case TO_FILE: print_to_file(doc_name); break; case TO_SCREEN: ...
Rituparna
0 0
7
If one leaves a lot of space in a C language code, will it require more space in a hard disk and RAM?
Head files tells system, how to deal with different functions with program such as printf(), scanf() , getche() etc. so you must have reference to it.
Abhishek
0 0
5

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

Some interview questions and answers for fresher level on Pointers
What is a void pointer? Void pointer is a special type of pointer which can reference or point to any data type. This is why it is also called as Generic Pointer. As a void pointer can point to...

Internet of Things, Social Media Becoming Part of E-Discovery Landscape
The days when e-discovery consisted of handing over copies of e-mails to address Freedom of Information Act (FOIA) requests, compliance regulations or other legal obligations are over. Now, it's just as...

Compiler vs Interpreter
Compiler Interpreter Convert all the code into binary format and execute. Convert one statement at a time and execute, then Convert next statement and execute. After conversion, source...

C Program-Error Handling[Program Exit Status]
//Header files #include<stdio.h>#include<conio.h>#include<stdlib.h> //Main Function void main(){ int dividend=20; int divisor=5; int quotient; //Function for clearing screen clrscr();...
S

C Program-String Comparison
// WAP to compare strings entered by the user //Header files #include<stdio.h>#include<conio.h>#include<string.h> //Main function void main(){ char str1; char str2; int comp; //Function...
S

Recommended Articles

Lasya Infotech is a Hyderabad based IT training institute founded in 2016 by O Venkat. Believing in his innovation, passion and persistence and with a diverse blend of experience, he started his brainchild to deliver exemplary professional courses to aspiring candidates by honing their skills. Ever since the institute envisions...

Read full article >

Brilliant Academy is one of the reputed institutes for B.Tech tuition classes. This institute is specialised in delivering quality tuition classes for B.E, Engineering - all streams and Engineering diploma courses. Incorporated in 2012, Brillant Academy is a brainchild of Mr Jagadeesh. The main motto of the academy is to...

Read full article >

Hadoop is a framework which has been developed for organizing and analysing big chunks of data for a business. Suppose you have a file larger than your system’s storage capacity and you can’t store it. Hadoop helps in storing bigger files than what could be stored on one particular server. You can therefore store very,...

Read full article >

Almost all of us, inside the pocket, bag or on the table have a mobile phone, out of which 90% of us have a smartphone. The technology is advancing rapidly. When it comes to mobile phones, people today want much more than just making phone calls and playing games on the go. People now want instant access to all their business...

Read full article >

Looking for C Language Classes?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you
X

Looking for C Language Classes?

The best tutors for C Language Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn C Language with the Best Tutors

The best Tutors for C Language Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more