Electrical and Computer Engineering
7 of 19
UAH
CPE 112
Scope Rules Explored (continued)
•void Block2()
•{
•   int a1;            // Prevents access to global a1
•   int b2;            // Local to Block2; no conflict
•                      // with b2 in Block1         
•   while (…)
•   {                 // Block3
•      int c1;        // Local to Block3; no conflict
•                      // with c1 in Block1
•      int b2;         // Prevents nonlocal access to b2
•                      // in Block2; no conflict with
•                      // b2 in Block1
•        .
•        .
•        .
•   }
•}