Reading a character
getc()getc() is a macro that reads one character from a stream.
getchar()
getchar() is a macro that gets a character from stdin. It returns the next character on the input stream stdin.
Eg:-1
/* Reading a character from the keyboard */
#include <stdio.h>
void main()
{
char ch;
printf("Enter a character:");
ch = getc(stdin);
printf("You have entered the character %c\n",ch);
}
No comments:
Post a Comment