Basic Program in C
BASIC INPUT/OUTPUT STATEMENT:
In C programming, input/output operations are essential for communicating a program to the user or other system components. The foundations of this communication, which enable dynamic interaction between C programs, are the "scanf" and "printf" routines.
scanf:
- Programs can receive data from the user during runtime thanks to the scanf function, which acts as the standard input statement.
- Programmers can ask users for input and store the answers they supply into variables by using scanf.
- The first argument to this method is a format string, which indicates the intended data type of the input. Subsequent arguments define the location of the input.
- As the standard output statement, printf makes it easier to display data on the console or other output streams.
- It allows developers to send messages, results, or any other desired output to the user or external systems by formatting and printing data to the standard output.
- Printf uses format specifiers in its format string, just as scanf, to decide how to display data.
FORMAT SPECIFIER:
Format specifiers tell the compiler how to interpret and display data in the output stream. These specifiers determine the format and placement of the data in the output.
Integer - %d
Float - %f
Character - %c
String - %s
Comments