Call By Reference: Difference between revisions

m
add syntax highlighting
(Tidyup, Categorisation)
m (add syntax highlighting)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
Call By Reference is a technique where arguments that are passed into a procedure or function are the actual memory resident values from the calling procedure.  When the value of an argument passed by reference is changed in the child procedure, the value of the argument in the parent procedure is also changed, since technically they are the same arguement.
'''Call By Reference''' or '''Pass By Reference''' is a technique where arguments that are passed into a [[procedure]] or [[function]] are the actual memory resident values from the calling procedure.  When the value of an argument passed by reference is changed in the child procedure, the value of the argument in the parent procedure is also changed, since technically they are the same arguement.


==Example==
==Example==
The following code passes a reference to the argument ''sName'' in to the procedure '''DoCall'''.
The following code passes a reference to the argument ''sName'' in to the procedure '''DoCall'''.
<pre>
<source lang="dataflex">
String sName
String sName


Line 15: Line 15:
Send DoCall(&sName)
Send DoCall(&sName)
showln "name:" sName
showln "name:" sName
</pre>
</source>


The output window would display:
The output window would display: