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

When is a "switch" statement better than multiple "if" statements?
switch statement is generally best to use when you have more than two conditional expressions based on a single variable of numeric type. For instance, rather than the code if (x == 1) printf(“x...
Shalu
What is the difference between #include< > and #include" "
first one is used for predefined header files.. and second is used for user defined header files
Priya
1 0
6
How can I write a C program to print a name without using a semicolon?
void main() { switch(printf("My name is john")) { } }
Anand
0 0
6

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

Ask a Question

Related Lessons

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


C Program-Vowels and Consonants
/*WAP to print the character entered by user is a vowel or consonant*/ //Header files #include<stdio.h>#include<conio.h> //Main functionvoid main(){ char c; //Function for clearing screen...

Dynamic Memory Allocation in C using malloc()
#include <stdio.h>#include <conio.h>//#include <malloc.h> OR#include <stdlib.h>void main(){ int *ptr, i, n, sum = 0; printf("how many elements ? "); scanf("%d", &n);...

Facts about C language
C programming language was developed in 1972 by Dennis Ritchie at AT&T Bell Labs. It was developed to overcome the problems of languages such as B, BPCL. It was developed to write the Unix operating...

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