Chapter 7
Input and Output
IN THIS CHAPTER
Using standard input and output
Reading and writing characters
Understanding getchar() and putchar()
Exploring the char variable type
Reading input with scanf()
Grabbing strings with fgets()
One of the basic functions, if not the basic function, of any computing device is input and output. The old I/O (say “eye oh”) is also the goal of just about every program. Input is received and processed, and then output is generated. The processing is what makes the program useful. Otherwise, you’d have only input and output, which is essentially the same thing as plumbing.
Character I/O
The simplest type of input and output takes place at the character level: One character goes in; one character comes out. Of course, getting to that point involves a wee bit of programming.
Understanding input and output devices
The C language was born with the Unix ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access