DamnSchool
The input and output function of computer facilitate communication with the external world. They also facilitate interactions between the computer and the user. The user has to popular medium i.e.., the peripheral device for input is the keyboard. Keying is of input data into the computer at run-time is achieved easily by library functions, which are supplied along with the "C" complier and have been standardised. The function which enable input keyboard are given below.
1. scanf()
2.getchar()
3.getch()
4.getche()
5.gets()

The computer communicates its output i.e., the result of computation. either through the console video monitor, printer , disk drive or Input/Output ports. Since we are learning "C" through the PC, we will get the output through the video monitor, to start with. Just as there are library functions for input, there are standard library function for output as well. They are given below.
1.printf()
2.putchar()
3.putch()
4.puts()

Given input and getting output are archived by using the standard library function as outlined above.
Note that all the function names are followed by parenthesis. The parenthesis are meant for passing arguments or getting arguments. The arguments may be absent in certain functions as in the case of main().However, function names must be followed by parenthese to indicate to the compiler that they are function. Arguments can be either variables or constants.

Control string

It is the type of data that the user going to accept via the input statements, this can be formatted and always preceded with a '%' sign the below table illustrates code formats (control strings) in input/output statement.

Format code Meaning
%c Single character
%d Decimal integer
%s strings
%f Float
%ld Long integer
%u Unsigned decimal
%o Octal number
%x Hexadecimal number
%e Floating point value
%h Short integer

< Previous Next >

Privacy Policy Terms of Service About
Creative Commons License
This work is licensed under a Creative Commons Attribution-NoDerivatives 4.0 International License.