C examples for Data Type:char
This process is called echoing the input.
It uses a while loop that terminates when the # character is encountered.
#include <stdio.h> int main(void) { char ch;/* w w w.ja va 2 s . c o m*/ while ((ch = getchar()) != '#') putchar(ch); return 0; }