External variable in the function parameter

Posted By: NeoNeper

External variable in the function parameter - 10/27/13 14:41

Code:
var vTemp = 0;
void getValue(var value)
{	
	value = 10;	
}

...

getValue(vTemp);



...

How can I modify the global variable specified in a function parameter?

Posted By: Ch40zzC0d3r

Re: External variable in the function parameter - 10/27/13 16:16

lol use pointers^^
Code:
var vTemp = 0;
void getValue(var *value)
{	
	*value = 10;	
}

...

getValue(&vTemp);

Posted By: NeoNeper

Re: External variable in the function parameter (SOLVED) - 10/27/13 17:41

I had already tried, but I was not having success too!
Code:
*value = 10; // I did not know I could declare this way



Tankx man (^.^)!
Posted By: Uhrwerk

Re: External variable in the function parameter (SOLVED) - 10/27/13 17:45

That's not a declaration. It's an indirection and an assignment.
Posted By: NeoNeper

Re: External variable in the function parameter (SOLVED) - 10/28/13 00:46

Oyaa. SOry (^.^)
© 2024 lite-C Forums