7 Local Variables and Procedures

So far, we’ve been using a design pattern called “one big mess.” All code is dumped into main, and all variables are defined at the beginning of the program. This method works fine when your program is 100 or fewer lines long, but when you’re dealing with a 500,000-line program, you’re going to need some organization. This chapter discusses ways of limiting the scope of variables and instructions so you can make long, unmanageable blocks of code easier to understand, manage, and maintain.

For example, you can use a global variable anywhere in a program. To know where and how it’s used in a 500,000-line program, ...

Get Bare Metal 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.