Examine the following code segment and consider what variable bindings will be visible at various points in the program under both STATIC and DYNAMIC scoping. 01 int h, i; 02 03 void B(int m) { 04    int j, k; 05    // what is visible HERE? 06    ... 07 } 08 09 void A(int j, int k) { 10   float h = j + k; 11   B(h); 12   ... 13 } 14 15 void main() { 16    int i, j; 17    18    A(h, i); 19    B(h); 20    ... 21 }

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter5: Control Structures Ii (repetition)
Section: Chapter Questions
Problem 27PE
icon
Related questions
Question

Examine the following code segment and consider what variable bindings will be visible at various points in the program under both STATIC and DYNAMIC scoping.

01 int h, i;
02
03 void B(int m) {
04    int j, k;
05    // what is visible HERE?
06    ...
07 }
08
09 void A(int j, int k) {
10   float h = j + k;
11   B(h);
12   ...
13 }
14
15 void main() {
16    int i, j;
17   
18    A(h, i);
19    B(h);
20    ...
21 }

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Reference Types in Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT