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

Why is the C language important?
C language is a high-level, general-purpose programming language. It provides a straightforward, consistent, powerful interface for programming systems. That's why the C language is widely used for developing...
Ganesh
0 0
5
Is C programming the best for beginners?
Yes, it is good to start with C so that other programming would be easy to understand
Amit
0 0
7
Is it better to bitshift a value than to multiply by 2?
yes in bitshifting operation, u know the shifting position of bit
Nadare
0 0
5
How do you override a defined macro?
We can use the #ifdef and #undef directive to undefine a previously defined macro.
Sharmistha

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

Ask a Question

Related Lessons

Programing Languages Learning Tricks
You want to learn that new language or library or framework as soon as possible, right? That’s understandable. Fortunately, there are a handful of tips that can help you to better retain all of that...

Harshal G.

0 0
0

Software Development Training In Jaipur
Satyam Web Solution provides website designing &development and software designing &development training in Jaipur for various stream’s students. MCA 6 month Industrial Training/Internship B....

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...

Tress And Its Traversal
Depth First Traversals:(a) Inorder (Left, Root, Right) : 4 2 5 1 3(b) Preorder (Root, Left, Right) : 1 2 4 5 3(c) Postorder (Left, Right, Root) : 4 5 2 3 1 Trees are one of the data structures like...

C and C++ programming with memory level debugging
Understanding C and C++ programming by using memory level debugging. Step 1: Understand the Memory map of C executable Step 2: Start memory level debugging using popular IDE Step 3: Find the memory...

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