15. Basic Input/output functions in C programming
Basic Input/output functions in C :
(1) scanf( ): It is used to take input from user. scanf( ) is used to read input values of variables by using input devices. The syntax of scanf( ) is given below:
scanf (“control string control string......”, & variable name 1, & variable name 2, ...... & variable name n) ;
(2) printf( ): It is used to display the output. printf( ) is used to print values of variable by using the output devices. The syntax of printf( ) is given below:
printf (“control string control string....”, & variable name 1, & variable name 2, .... & variable name n);
(3) getchar( ): It is a character input/output function which reads a character from keyboard at a time. The syntax is as follows:
char variable=getchar( );
(4) getch( ): It is a character input/output function which reads a character from the keyboard and it does not expect the enter key press. The syntax is as follows:
char variable=getch( );
(5) getche( ): It is a character input/output function which reads a character from keyboard and echos it. The syntax is as follows:
char variable=getche( );
(6) gets( ): It is a character input/output function which reads a line or a string of characters including white spaces from the keyboard. The syntax is as follows:
char variable=gets( );
(7) putchar( ): It is a character input/output function which writes a character to monitor screen at a time. The syntax is as follows:
putchar (charvariable);
(8) putch( ): It is a character input/output function which writes a
character to the monitor screen at a time. The syntax is as follows:
putch (charvariable);
(9) puts( ): It is a input/output function which writes or displays a line or
a string of characters including white spaces on t6he monitor screen.
The syntax is as follows:
puts (character string variable);
(10) clrscr( ): It is a character input/output function which is used to clear
the monitor screen. The syntax is as follows:
clrscr( );
Comments
Post a Comment