Howdy, Stranger!

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

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

value parameter, variable parameter

mattermatter Posts: 3Member
Hello

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!!!

Thanks
matter

Comments

  • quikcarlxquikcarlx Hollywood, FlPosts: 26Member
    "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
    examples:
    [code]
    {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 );
    [/code]
Sign In or Register to comment.