Usage of getch() Function in C or C++

Usage of getch() Function in C or C++ : Like a scanf() function in c, getch() is also a predefined function to accept input and define in conio.h header file. scanf() accept only number or character as input, but getch() accept any key as input and work further.

#include<stdio.h>
#include<conio.h>
void main()
{
	char ch;
	ch=getch();
	printf("\n ASCII Code of Key : %d",ch);
}

Note : Work with Turboc Editor

 

Share with your Friends...
Be the First to comment.

Leave a Comment

Your email address will not be published. Required fields are marked *

The NuCaptcha API requires the PHP mcrypt module.