what is the use of getch() function in C program..
difference b/w getch() and getche()??

Answer Posted / lekha

Both getch() and getche() are used to read single character
there is very little difference
-getch() doesn't display output to screen if used without lvalue
-getche() display output to screen even if used without lvalue

following example will clear this.....
1.
main()
{
getch();
}
2.
main()
{
getche();
}
after running above programs...............
when you press any key, you'll exit from output screen
verify the output by pressing alt+F5
1. will not show anything
2.will show the key you were pressed......
hope you get it.............

Is This Answer Correct ?    9 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Design a program which assigns values to the array temperature. The program should then display the array with appropriate column and row headings.

1761


What are the different types of constants?

636


Describe static function with its usage?

604


how can i write a program that prints out a box such that whenever i press any key8(coordinate number) on the keyboard, the box moves.

1207


How can I dynamically allocate arrays?

585






What is the use of typedef in c?

577


What is the Purpose of 'extern' keyword in a function declaration?

643


Explain what is output redirection?

659


What is the argument of a function in c?

567


What is c mainly used for?

591


What is the difference between union and structure in c?

567


Can you assign a different address to an array tag?

692


If you know then define #pragma?

670


What is the difference between exit() and _exit() function in c?

576


Explain how does free() know explain how much memory to release?

569