content_image/755555.jpg
<img src='content_image/755555.jpg'>

program Parameters(Output); { Program 11.3 - Illustrate value and var parameters. var A, B: Integer; procedure Addl(X: Integer; var Y: Integer); begin X := X + 1; Y:= Y + 1; Writeln(Output,X,Y) end { Addl }; begin A := 0; B:= 0; Addl(A,B); Writeln(Output,A,B) end { Parameters }. 

Produces as results: 

1 o 1 1 

In procedure MinMax of Program 11.2 none of the values in array L are altered; i.e., L is not a result. Consequently L could have been defined as a value parameter without affecting the end result. To understand why this was not done, it is helpful to look at the implementation. 

A procedure activation allocates a new area for each value parameter; this represents the local variable. The current value of the actual parameter is "copied" into this location; exit from the procedure simply releases this storage. 

If a parameter is not used to transfer a result of the procedure, a value parameter is generally preferred. The accessing may be more efficient, and you are protected against mistakenly altering the data. However in the case where a parameter is of a structured type (e.g., an 

