top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is the difference between getch( ) and getche( ) in C?

+3 votes
443 views
What is the difference between getch( ) and getche( ) in C?
posted Sep 19, 2014 by Swati Arora

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

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 any key
1. will not show anything
2.will show the key you were pressed......

answer Sep 19, 2014 by Aarti Jain
...