Chapter 22. Putting It All Together
For there isn’t a job on the top of the earth the beggar don’t know, nor do.
In this chapter, we create a complete program. Every step of the process is covered from setting forth the requirements to testing the result.
Requirements
Before we start, we need to decide what we are going to do. This step is very important and is left out of far too many programming cycles.
This chapter’s program must fulfill several requirements. First, it must be long enough to demonstrate modular programming, but at the same time be short enough to fit inside a single chapter. It must be complex enough to demonstrate a wide range of C features, but be simple enough for a novice C programmer to understand.
Finally, the program must be useful. Usefulness is not simple to define. What’s useful to one person might not be useful to another. We decided to refine this requirement and restate it as “The program must be useful to C programmers.”
The program we have selected reads C source files and generates simple statistics on the nesting of parentheses, and in the ratio of comments to code lines.
Specification
The specification for our statistics program is shown in the following sidebar:
Get Practical C Programming, 3rd Edition 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.