Getchar function scans the single character from user it will only take 1 character it will terminate on pressing "Enter". Let us see syntax...:
Syntax:
variable=getchar();
Example Program for Getchar function:
#include<stdio.h>
#include<conio.h>
main()
{
char c;
clrscr();
printf("Enter Any character: ");
c=getchar();
printf("\nYou have Entered %c",c);
getch();
}
Syntax:
variable=getchar();
Example Program for Getchar function:
#include<stdio.h>
#include<conio.h>
main()
{
char c;
clrscr();
printf("Enter Any character: ");
c=getchar();
printf("\nYou have Entered %c",c);
getch();
}