Address of a variable: Difference between revisions
Content added Content deleted
Line 1,243: | Line 1,243: | ||
From version 12, VarPtr() can return address for variables and array items. |
From version 12, VarPtr() can return address for variables and array items. |
||
We can't set an address to a variable. We can link a variable name with an existing variable. |
We can't set an address to a variable. We can link a variable name with an existing variable. Is the same as passing by reference. |
||
<syntaxhighlight lang="m2000 interpreter"> |
<syntaxhighlight lang="m2000 interpreter"> |
||
Line 1,255: | Line 1,255: | ||
print k(1,0,1)=x |
print k(1,0,1)=x |
||
link z to m |
link z to m |
||
print VarPtr(z)=VarPtr(m) |
|||
checkref(&z) |
|||
sub checkref(&p) |
|||
print VarPtr(z)=VarPtr(p) |
|||
end sub |
|||
} |
} |
||
checkVarptr |
checkVarptr |
||
Line 1,261: | Line 1,265: | ||
{{out}} |
{{out}} |
||
<pre> |
<pre> |
||
True |
|||
True |
True |
||
True |
True |