Thursday, December 10, 2009

3.1 SINGLE CHARACTER INPUT- THE getchar FUNCTION

Single characters can be entered into the computer using the C library function getchar.

In general terms, a function reference would be written as

character variable =getchar();

A C program contains the following statements.

char c;
..........
c=getchar();

The first statement declares that c is a character type variable.The second statement causes a single character to be entered from the standard input device and then assigned to c.

No comments:

Post a Comment