answersLogoWhite

0


Best Answer

It's just a nasty trick to prevent the DOS-shell-window from closing when the program terminates.

It's strictly for homeworks/school-projects, do not do it in real programs.

User Avatar

Wiki User

15y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Why program ends with getch in C?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you get a char from the keyboard in your C program without waiting?

OS-dependent. For DOS use functions kbhit and getch from conio.h


How do you install curses header file in fedora Linux in order to use getch function in a c an c plus plus program?

dnf install ncurses-devel


Can you give us a example program of perfect square in turbo C?

#include <stdio.h> #include<process.h> #include<conio.h> void main() { float n,i,c; printf("Enter the number"); scanf("%d",&n); for(i=1;i<=n/2;i++) { c=n/i; if(c==i) { printf("Perfect Square"); getch(); exit(0); } printf("Not a Perfect Square"); getch(); }


What happens if you create a loop in C program that never ends?

then your program will never ends, too unless you pressing the ctrl+c or kill it through your os. can i know the purpose of you creating the loop that never ends? is it just a mistake or are you doing it on purpose?


Can you replace getch of C programming in Linux without using iostream header?

There is a 'getch' in 'conio.h' which has nothing to do with 'iostream'.


Built-in functions in turbo c?

i want a coding of a program of a calculator using graphics in c language??


Write a program to calculate the area of a circle?

#include<stdio.h> void main() { int r=10; float pi=3.14,c; c=pi*r*r; printf("Area of the circle=%f",c); getch(); }


In C how can you make a program that allowing the user press a key then process without pressing Enter key use getch but how?

How can I program that when the user press a key, it will automatically process like 4 example:The user press wYou just press the key 'w'Not scanf...I think it's getch but I don't know how. It have errors.


Where is the c program stored?

Text files, mainly. The name of the files usually ends with .C and .H (lowercase in unix).


How do you use getch function in c language?

getch is used for console applications and it's very useful because in a way how windows work when a console application has finished it's part windows closes it automatically with the code 0 meaning that program did not have any problems while was running. To prevent automatic shutdown for console applications getch can be used. So, when your program has finished all operations it will wait for an input (basically you will have to press any key to finish the application) from the user.


How develop c program that swap two number with out using temporary variable?

void main() { int a=2,b=5; b=a+b; a=b-a; b=b-a; getch(); }


What use getch function in c language?

Gets one character (or keystroke) without buffering or echoing; beware: getch is not part of the standard library.