Chapter 24
Beyond Mere Mortal Projects
IN THIS CHAPTER
Building big programs
Combining multiple source code files
Making your own header file
Linking in additional libraries
Not every C program you write will have only 20 or 30 lines of code. Most of the programs, the ones that truly do something, are much longer. Much, much longer. Some become so huge that it makes sense to split them into smaller modules, or individual source code files, with maybe 20 to 60 lines of code apiece. Not only do these smaller modules make it easier to write and update code, but you can also reuse common modules in other projects, reducing development time.
The Multi-Module Monster
The C language places no limit on how long a source code file can be. Likewise, a source code file can consist of only a few lines — if you can pull off this trick. The determination of whether to use multiple source code files — modules — really depends on the programmer. That’s you. How easy do you want to make the process of writing, maintaining, and updating your code?
Linking two source code files
The most basic multi-module ...
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