what is the difference between getch() and getchar()?

Answer Posted / shivani

getchar() is a function call: it reads in a single
character and waits for the user to hit 'enter key' before
reading the character. This line is included because many
compiler environments will open a new console window, run
the program, and then close the window before you can see
the output. This command keeps that window from closing
because the program is not done yet because it waits for
you to hit enter. Including that line gives you time to see
the program run.
getch() is not waiting to press enter to show output on
screen.
but getchar() is waiting to press enter to show output.

Is This Answer Correct ?    9 Yes 10 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why is this loop always executing once?

617


Can we declare variable anywhere in c?

535


Who is the main contributor in designing the c language after dennis ritchie?

553


Want to know how to write a C program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the total number of disk writes by MySQL.

1521


What happens if a header file is included twice?

598






What is memcpy() function?

622


Why is struct padding needed?

631


Do pointers take up memory?

657


Define VARIABLE?

690


Describe dynamic data structure in c programming language?

605


Write the Program to reverse a string using pointers.

617


Why is c called a structured programming language?

678


which is conditional construct a) if statement b) switch statement c) while/for d) goto

739


write a c program for swapping two strings using pointer

2094


Can you please explain the difference between malloc() and calloc() function?

620