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
How is actual parameter different from the formal parameter?
What is a const pointer?
Difference between malloc() and calloc() function?
What does int main () mean?
What is clrscr ()?
What is a null pointer assignment error? What are bus errors, memory faults, and core dumps?
Explain what is a const pointer?
What is the difference between malloc() and calloc()?
Why n++ execute faster than n+1 ?
What are run-time errors?
Which header file is used for clrscr?
Can we access array using pointer in c language?
What is the basic structure of c?
What is the use of function overloading in C?
Explain what are bus errors, memory faults, and core dumps?