Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (TipmyPip), 18,633 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Variable-Pointers #410871
11/10/12 12:25
11/10/12 12:25
Joined: Apr 2008
Posts: 144
Germany | Niedersachsen (Lower...
Roxas Offline OP
Member
Roxas  Offline OP
Member

Joined: Apr 2008
Posts: 144
Germany | Niedersachsen (Lower...
Heya~

I've got a little problem with lite-c.

I want to set the value of a variable in another function without defining it globally. I could easily make the function returning the value, but the function already has a return value.

I thought about variable pointers and tried the following, but It doesn't work after all:

Code:
int someFunction(var var1, var var2, var* var3)
{
    // set var3 to a certain value
    var3 = 100;
    
    // do some stuff with var 1 and var 2 and return var 1
    ...
    return var1;
}

int anotherFunction()
{
    var someVariable; 
    var anotherVariable; 

    // do some stuff and call someFunction
    ...
    someVariable = someFunction(100,100, anotherVariable);

    // 
    ...
}



I expected that the "anotherVariable"-Variable would've been set to 100, but it was not.

What am I doing wrong, or is this even possible with lite-c?

Thanks in Advance,

Cheers
Roxas

Re: Variable-Pointers [Re: Roxas] #410885
11/10/12 14:07
11/10/12 14:07
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Kartoffel Offline
Expert
Kartoffel  Offline
Expert

Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
to access var3 as a pointer use:
*var3 = 100;
smile


POTATO-MAN saves the day! - Random
Re: Variable-Pointers [Re: Kartoffel] #410890
11/10/12 14:27
11/10/12 14:27
Joined: Apr 2008
Posts: 144
Germany | Niedersachsen (Lower...
Roxas Offline OP
Member
Roxas  Offline OP
Member

Joined: Apr 2008
Posts: 144
Germany | Niedersachsen (Lower...
Ah I see,

thanks a lot mate. That helped me a lot.

Cheers
Roxas


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1