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

Answer Posted / pinky

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() returns back on reading any character(a-z) or any
hit to the keyboard.

Is This Answer Correct ?    34 Yes 12 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the maximum length of an identifier?

667


What are the advantages and disadvantages of pointers?

578


why return type of main is not necessary in linux

1706


show how link list can be used to repersent the following polynomial i) 5x+2

1678


What is a program flowchart and how does it help in writing a program?

665






Explain can the sizeof operator be used to tell the size of an array passed to a function?

597


Difference between strcpy() and memcpy() function?

679


 write a program that will open the file, count the number of occurences of each word in the the complete works of shakespeare.  You will then tabulate this information in another file.

1730


What are the characteristics of arrays in c?

616


What is getch() function?

649


What is #define size in c?

648


When should structures be passed by values or by references?

585


What is difference between %d and %i in c?

693


Explain what is a pragma?

594


What is difference between array and structure in c?

580