Either remove the ungetc(), or read the data from stdin after calling ``inchar()''.
Code:
printf( "%c\n", inchar() );
getchar();
printf( "%c\n", inchar() );