Chapter 25: Understanding Scope
In every program we have created thus far, functions have been available—which means callable—from everywhere else within the program. Even in the multi-file program of Chapter 24, Working with Multi-File Programs, every function in every file is available/callable from within every other file. This is not always appropriate, nor is it always desirable. Likewise, some variables should only be accessed from within specific functions, or for use within a specific group of functions.
There are many instances where it is appropriate to limit the availability of a function or the accessibility of a variable. For instance, some functions may operate on a given structure and should only ever be called by other functions ...
Get Learn C Programming - Second 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.