Computer Science 2211A/B Lecture Notes - Lecture 11: Scanf Format String, Undefined Behavior, Local Variable
Document Summary
Scope rules allow us to determine which meaning is relevant. Most important scope rule: when a declaration inside a block names an identifier that is already visible, the new declaration temporarily hides the old one and the identifier is the new one. At the end of the block, the identifier regains its old meaning. Declaration 1: i is a variable (file scope) Declaration 2: i is parameter with block scope. Declaration 3: i is an automatic variable (block scope) Declaration 4: i is automatic variable (block scope) Most computers, main memory is divided into bytes and each byte is capable of storing. Each variable in a program occupies one or more bytes of memory. If there are n bytes of memory, addresses as numbers range from 0 to n-1. Address of the first byte is address of variable. Addresses can be stored in special pointer variables. Storing address of variable i in p is saying p points to i .