A stack is used to pass parameters to procedures in a procedure call.
If a procedure $P$ has two parameters as described in procedure definition:
procedure P (var x :integer; y: integer);
and if $P$ is called by ; $P(a, b)$
State precisely in a sentence what is pushed on stack for parameters $a$ and $b$
In the generated code for the body of procedure $P$, how will the addressing of formal parameters $x$ and $y$ differ?
var x:integer means pointer and y:integer means variable
@Digvijay Pandey, can you please explain it?
@Digvijay Pandey can you eexplain how is it identify....?????
Since the variable x is passed by reference, it is a pointer to an integer. y is an integer variable. The syntax is of Pascal and it is not in syllabus anymore.
For part a)
Now the producer can be called which then pushes its Return address into the Stack with a pointer SP.
To access these parameters we need to access [SP+2], [SP+4] (Stack fills from higher memory address to lower memory address, so if location 'a' is 10 and 'b' is 8 then SP will be on 6).