© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2024
S. DmitrovićModern C for Absolute Beginnershttps://doi.org/10.1007/979-8-8688-0224-9_26

26. Storage and Scope

Slobodan Dmitrović1  
(1)
Belgrade, Serbia
 

Variables and data objects have certain properties such as visibility, scope, storage, and lifetime. These terms are all closely related, and here, we explain how they affect each other. We describe how names are visible to other names and how much time the data objects spend in memory.

26.1 Scope

When a variable (or a function) is declared, its name is only valid inside some portion/section of a source code. That section of a source code is called a scope. There are different kinds of scopes – local scope and ...

Get Modern C for Absolute Beginners: A Friendly Introduction to the C Programming Language 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.