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 can you draw circles in C?
How do you write a program which produces its own source code as output?
a parameter passed between a calling program and a called program a) variable b) constant c) argument d) all of the above
What is pragma in c?
Explain what is wrong with this statement? Myname = ?robin?;
.main() { char *p = "hello world!"; p[0] = 'H'; printf("%s",p); }
An instruction which is analysed and acted upon by the processor prior to the compiler going its work a) directive b) constructive c) constant d) absolute mode
How can you increase the size of a statically allocated array?
Where are some collections of useful code fragments and examples?
Do variables need to be initialized?
Which node is more powerful and can handle local information processing or graphics processing?
c language interview questions & answer
Explain the use of 'auto' keyword in c programming?
What is the size of enum in bytes?
What is a wrapper function in c?