Question: Consider the following pseudocode: procedure main ( ) b : integer : = 1 c : integer : = 2 procedure first ( ) b
Consider the following pseudocode:
procedure main
b : integer :
c : integer :
procedure first
b : integer : c
c : integer : a
procedure second
print a b c
a : integer :
body of first
second
print a b c
body of main
first
For each of the following three scenarios, specify
which statements in which line number will cause a
static semantic error and why:
a names must be declared before use, and the scope
of a name extends from its declaration through the
end of the block?
b names must be declared before use, but the scope
of a name is the entire block in which it is declared?
c names can be declared in any order, and their
scope is the entire block in which they are declared?
Suppose that procedure swap is declared as follows using
Pascal syntax:
procedure swapx y: integer;
procedure fa: integer;
begin f
a : y;
return x
end f;
begin swap
y : fx
end swap;
Describe the effect of the procedure call swap i
A i assuming that macro expansion is used.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
