O'Reilly logo

Absolute Beginner’s Guide to C, 2nd Edition by 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

31. How Do Functions Share Data?

By Passing Variables

image

The preceding chapter left some questions unanswered. If multiple functions are good (they are), and if local variables are good (they are), then you must have a way to share local variables between functions that need to share them (there is a way). You don’t want all functions to have access to all variables, because not every function needs access to every variable. If full variable access between functions is needed, you might as well use global variables.

To share data ...

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