Question: urgent 3. Consider the following pseudocode: 1. procedure main () 2. a: integer: =3 3. b : integer : =5 4. c: integer :=7 5.
3. Consider the following pseudocode: 1. procedure main () 2. a: integer: =3 3. b : integer : =5 4. c: integer :=7 5. procedure firsto 6. b: integer : =c 7. c: integer :=b 8. procedure second 9. print a,b,c 10. a : integer : =2 11. --body of first 12. second( 13. print a,b,c 14. --body of main 15. first 0 16. print a,b,c Suppose this was code for a language with the declaration-order rules of C (but with nested subroutines)-that is, names must be declared before use, and the scope of a name extends from its declaration through the end of the block. At each print statement, indicate which declarations of a,b and c are in the referencing environment. What does the program print (or will the compiler identify static semantic errors)? Repeat the exercise for the declaration-order rules of CH (names must be declared before use, but the scope of a name is the entire block in which it is declared)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
