Input and Output (I/O) operations in C are used to accept data from the user and display output to the screen.
C provides standard I/O functions through the stdio.h header file.
printf() – Displays output on the screen
scanf() – Reads input from the user
Used to display output.
Used to take input from the user.
| Specifier | Meaning |
|---|---|
%d | Integer |
%f | Float |
%lf | Double |
%c | Character |
%s | String |
Reads a single character
Displays a single character
gets() – Reads a string (unsafe, not recommended)
puts() – Displays a string
stdio.h provides I/O functions
printf() outputs data
scanf() inputs data
Format specifiers define data type
& is used to store input in variables
Take quizzes related to this topic and see where you stand!
Start Quiz Now