Let's say I have a not simple data Type, an array or a structure (Type). So it would not easy to return the whole structure (Type) or is not possible because I have to return an errorcode or something else.
Example:
Type MyType
a as integer
b as integer
EndType
Function MyFunction(v1 as integer, v2 as MyTpe)
v2.a = v1
value = v2.b + 7
EndFunction value
// Main
q as MyType
g as integer
q.b = 5
g = MyFunction(8,q)
......
What do I have to do, if I wanted also "q"s a changed in memory?
So that I could use the function again.
g = MyFunction(8,q)
And g would hold now 5+(7)+7?
I don't want to make "q" global. And don't want to return the complete structure variable (Type) every time. I am thinking of referencing to the variable itself, so that it will be changed itself and not only a copy of it, what I later have to set my variable to it.
If you are interested in the complex problem, please look at this code. I used global variables, because I did not want to change the structure of the code to much from it's original c-code.
https://forum.thegamecreators.com/thread/219370
Thanks for help.
Kind regards, xaby.