Chapter 4Pointers

DOI: 10.1201/9781003257981-4

4.1 Scope

Chapter 2 described several rules about the stack memory. One of those rules was that each function could see only its own frame. This is called scope. A new scope is created every time a pair of { and } is used. This could be inside of a function body, for example, an if statement, or a while loop. The following example shows two scopes:

In the scope ...

Get Intermediate C Programming, 2nd 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.