Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

getch in c

getch() Function is used to get a Character from console but does not echo to the screen. Below is the declaration and example of getch() function.

Declaration : int getch(void);

Here,declare the variable gch as char data type, and then get a value through getch() function and store it in the variable gch.And then, print the value of variable gch.
During the program execution, a single character is get or read through the getch() Function. The given value is not displayed on the screen and the compiler does not wait for another character to be typed.And then,the given character is  printed through the printf function.
void main()
{

    char gch;
    ch = getch();
    printf("Input Char is :%c",ch);

}



This post first appeared on Ask For Program, please read the originial post: here

Share the post

getch in c

×

Subscribe to Ask For Program

Get updates delivered right to your inbox!

Thank you for your subscription

×