getche in c

getche function prompts the user to press a character and that character is printed on screen.

C code for getche
#include<stdio.h>
#include<conio.h>

main()
{
   printf("Waiting for a character to be pressed from the keyboard to exit.");

   getche();
   return 0;
}
Run this program and press a character. Then view the user screen (Alt+F5) if using turbo c. You will find the character printed on the screen if you pressed a printable character. Try pressing enter or tab key (non printable) characters also.

Comments

Popular posts from this blog

Difference between asterisk and ampersand operators in c

kbhit in c