Search This Blog

Loading...

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);

}

No comments:

Post a Comment