Electrical and Computer Engineering
5 of 19
UAH
CPE 112
Local Definitions Take
Precedence Over Global Ones
•void SomeFunc(float c)   // Prevents access to global c
•
•{  
•    float b;           // Prevents access to global b
•
•    b = 2.3;             // Assignment to local b
•
•    cout << “a = “ << a;  // Output global a(17)
•    cout << “b = “ << b;  // Output local b(2.3)
•    cout << “c = “ << c;  // Output local c(42.8)
•}