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

How can I try to remember the coding in C language?
One shouldn't try to remember the coding. The right approach is to understand the logical solution to the problem.
Chinmayee
0 0
5
What is a macro, and how do you use it?
A macro is a fragment of code which has been given a name. Whenever the name is used, it is replaced by the contents of the macro. There are two kinds of macros. They differ mostly in what they look...
Sandeep
What is the structure of a C program?
A C program typically starts with preprocessor directives, followed by global variable declarations. It then defines functions, one of which must be the main() function, serving as the entry point. The...
Igno
0 0
5
Why is there no C-- language that simplifies the C language?
Creating C-- to simplify C isn't necessary; evolving languages like Rust, Go, or C++ offer modern alternatives.
Komal
0 0
7

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

Ask a Question

Related Lessons

Why Indexing Should Start From Zero In Array ?
Why numbering should start at zero? To denote the subsequence of natural numbers 2, 3, ..., 12 without the pernicious three dots, fourconventions are open to usa) 2 ≤ i < 13b) 1 < i ≤ 12c)...

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 FOR GENERATING SOUND
#include<stdio.h> #include<conio.h> #include<dos.h> void main() { sound(3000); // sound function have single parameter , this parameter we put integer value its generating...

V. Muthu Ganeshan

0 0
0

Pointers Concept
Every variable has a memory location and every memory location has its address defined which can be accessed using ampersand (&) operator, which denotes an address in memory. Consider the following...

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