> getchar <STDIO.H> ~ Online tutorial

getchar



getchar  <STDIO.H>

   getchar is a macro that gets a character from stdin
 
 Declaration:
   int getchar(void);
 
 Remarks:


getchar is a macro defined as getc(stdin) getchar returns the next character
on the input stream stdin.

 Return Value:
 On success,
     getchar returns the character read, after converting it to an int
       without sign extension.
   
 On error (and on end-of-file for getchar), both macros return EOF.

Program


#include <stdio.h>

int main(void)
{
   int c;

   /* Note that getchar reads from stdin and
      is line buffered; this means it will
      not return until you press ENTER. */

   while ((c = getchar()) != '\n')
      printf("%c", c);

   return 0;
}



Please Give Us Your 1 Minute In Sharing This Post!
Please Give Us Your 1 Minute In Sharing This Post!
SOCIALIZE IT →
FOLLOW US →
SHARE IT →
Powered By: BloggerYard.Com

0 comments: