C is a functional programming language. C provides library of functions to perform input-output operations. This library is called a standard input-output library. It is denoted by stdio. The header file containing such library functions is called stdio.h. Some standard input-output functions in C are:
- Formatted I/O statements
- Unformatted I/O statements
- To read the values for the variables in a program from the keyboard , C provides a function called scanf().
- It is equivalent to the READ statement.
- It is included in stdio.h header file.
The syntax of scanf() :
|scanf(” control string” , address_list );|
NOTE: The character f in the scanf() shows the format(” “) of this function.
- It is used to display the data on the monitor.
- It is included in the stdio.h header file.
The syntax of printf() is:
|printf(“Control string” , variable);|
NOTE: The character f in the printf() shows the format(” “) of this function
- Files that are placed before main() of a C program are called header files.
- The header files are used to provide necessary information.
- Header files contain library functions.
- They can be written with in the angle brackets or the double quotes.
- The header files usually contains .h as extension.
- They are entered into the source program via #include directive.
- C processor is a collection of special statements are called preprocessor directive.
- It is executed before the C program is complied.
- The preprocessor directive begin with the # symbol and followed by either the include or define keyword.
- They are used to include files into a program.
where #include is a preprocessor directive and <stdio.h> is a header file.