value parameter, variable parameter


I`m trying to understand what this is all about "value parameter" and
"variable parameter" in procedures.

Let`s say I have some procedure: proc1(a,b :integer)

and some operations on a and b (maybe together with other variables x,y,z)
when does it affect the outcome of the procedure at choosing a,b as value parameter or variable parameter?

I`m really confused about this and hope you can help me!!!



  • quikcarlxquikcarlx Hollywood, Fl
    "Value parameter(s)" are passed to procedures and functions as static value(s). That means you
    send to the procedure or function a value (it's put on the call stack as the value). "Variable
    parameter(s)" are passed to procedures and functions as dynamic and are the address(es) of the
    variable. With the address you can pass values to and from the procedure(s) or function(s). As
    {value passing}

    procedure valproc ( a, b : integer ); { can be used in the procedure, but nothing
    can be sent back }

    {variable passing}

    procedure varproc ( var x, y : integer ); { can be used and can be sent back with
    the same or different values }
    {both types}

    procedure bothproc ( a, b : integer; var x, y : integer );
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion