C Managing Input ⁄ Output Operations

Single character input output

The basic operation done in input output is to read a characters from the standard input device such as the keyboard and to output or writing it to the output unit usually the screen.
The getchar function can be used to read a character from the standard input device.
The scanf can also be used to achieve the function.
The getchar has the following form.
Variable name = getchar();

Variable name is a valid ‘C’ variable, that has been declared already and that possess the type char.

Sample program (getchar)

# include 'stdio.h'               // assigns stdio-h header file to //your program 
void main ( )                       // Indicates the starting point of the //program. 
	char C,                         // variable declaration 
	printf (“Type one character:”); // message to user 
	C = getchar () ; // get a character from key board //and Stores it in variable C. 
	Printf (” The character you typed is = %c”, C) ;  

Make Comments..!!

Oops!! No posts from user.

Download Android App