Use the getchar() function to read user input - C Data Type

C examples for Data Type:char

Description

Use the getchar() function to read user input

Demo Code

#include <stdio.h>

int main( void )
{
   int ch;//ww  w . j a  v a2  s. c  o m

   while ((ch = getchar()) != '\n')
        putchar(ch);

   return 0;
}

Result


Related Tutorials