> Gets Character from stdin >> Stdio.h Header File Comments Feed" href="https://www.c4learn.com/fgetchar-stdioh-header-file-in-c.html/feed"/>

fgetchar >> Gets Character from stdin >> Stdio.h Header File

June 20, 2024 No Comments » Hits : 204





fgetchar :

  1. fgetchar gets a character from stdin
  2. The fgetchar() function is equivalent to fgetc() with the argument stdin.
#include<stdio.h>int main(void){    char ch;
   /* prompt the user for input */    printf("Enter a character : ");
  /* read the character from stdin */    ch = fgetchar();
  /* display what was read */    printf("The character read is: '%c'",ch);
  return 0;}

Return Type :

  1. On Success : Next character from the input stream pointed to by stdin.
  2. On end-of-file : Returns EOF 
  3. On error : Returns EOF 

Incoming search terms: