Input && Output, Part 1.
Table of contents
Introduction
Input and Output are also called I/O
. I/O has one of the most basic functions of a computing device is I/O since Charles Babbage built the Analytical Engine in 1822.
To understand better, you should consider the result of all programming to be telling hardware what to do. Under the hood of the computing device, input is received and processed then output is generated. When you write code, the code becomes the input, and its outcome is the output.
I/O Rules
The Rules of I/O in C programming are pretty simple:
- Input comes from the standard input device (
stdin
). - Output is generated by the standard output device (
stdout
).
If you have experience with Bash programming or the workings of a Unix-like OS, these rules aren't foreign. The creation of the C programming language happened in tandem with the Unix OS, and that's why it follows the rules for that OS regarding I/O.
I/O Devices
Conventionally, stdin
is the keyboard but the input can also be redirected by the OS to make it come from a device like a WiFi router/modem or from a file.
Conventionally, stdout
is the display, but the output can be redirected so that it goes to another device, such as a printer or into a file.
Even though programs can get input from the keyboard and send output to the screen, you should approach the C language I/O in terms of stdin
and stdout
devices instead. This is because your program will only input from the keyboard and the output to the screen when you code it to do so, and this is why you need to think about C language I/O in terms of stdin
and stdout
devices.
Subscribe to my newsletter
Read articles from Iano directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Iano
Iano
I Document My Journey In Blockchain Development And Build In Public.