Programs with Sequence Logic

In this chapter, we will explain the following:

  • The idea of reading data supplied by a user
  • How the scanf statement works
  • How to read numeric data using scanf
  • How to read string data using gets
  • Important principles of program writing using several examples

3.1 Introduction

In the last chapter, we introduced some of C’s basic data types—int, double, and float—and used simple statements to illustrate their use. We now go a step further and introduce several programming concepts by writing programs using these types.

The programs in this chapter will be based on sequence logic—that simply means the statements ...

Get Learn to Program with C now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.