Input and Output in C
📘 C
👁 37 views
📅 Dec 22, 2025
⏱ Estimated reading time: 1 min
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.
Standard Input and Output Functions
Output Function
-
printf()– Displays output on the screen
Input Function
-
scanf()– Reads input from the user
printf() Function
Used to display output.
Syntax
Example
scanf() Function
Used to take input from the user.
Syntax
Example
Format Specifiers
| Specifier | Meaning |
|---|---|
%d | Integer |
%f | Float |
%lf | Double |
%c | Character |
%s | String |
Example Program (Input and Output)
getchar() and putchar()
getchar()
-
Reads a single character
putchar()
-
Displays a single character
gets() and puts() (Basic understanding)
-
gets()– Reads a string (unsafe, not recommended) -
puts()– Displays a string
Summary
-
stdio.hprovides I/O functions -
printf()outputs data -
scanf()inputs data -
Format specifiers define data type
-
&is used to store input in variables
🔒 Some advanced sections are available for Registered Members
Register Now
Register Now
Share this Post
← Back to Tutorials