Pages

Saturday, 8 July 2017

Getch

Getch takes input a character from keyboard.  Getch is different from scanf because user need to press enter explicitly to complete input process but getch intensely return pressed key ASCII.

Some people used getch  to hold program output because when getch excuted it wait for a character and until user press a character next statement would not get executed.
So if  getch is used as last statement of your program it will hold output without using cntl + f5.
*/
#include<stdio.h>
void main()
{
    char ch;
    clrscr();
    printf("Enter a character>> ");
    ch=getch();
    printf("\nInput character is %c",ch);

}

Download PDF
Download C File


No comments:

Post a Comment