O'Reilly logo

C Programming Absolute Beginner’s Guide, Third Edition by Dean Miller, Greg Perry

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

30. Organizing Your Programs with Functions

In This Chapter

Adding functions to programs

Choosing between global and local variables

Typical computer programs are not the 20- to 30-line variety that you see in textbooks. In the “real world,” computer programs are much longer—but long programs contain lots of code that can get in the way while learning new concepts. That’s why, until this point, you’ve seen fairly short programs that contain all their code in main().

If you were to put an entire long program in main(), you would spend a lot of time trying to find anything specific if you later needed to change it. This chapter is the first of three chapters that explore ways to partition your programs into sections via multiple functions. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required