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,546 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
removing a struct from memory ( free() ) #315957
03/20/10 13:32
03/20/10 13:32
Joined: Jan 2002
Posts: 300
Usa
Rich Offline OP
Senior Member
Rich  Offline OP
Senior Member

Joined: Jan 2002
Posts: 300
Usa
Hello,

I just have a quick question. I have a pointer to a struct stored in an entity skill. Before I remove the entity, I have this piece of code:

free( &my.skill[99] );

is this the proper syntax to free the memory that was used by the struct? It seems to work with no errors, I'm just making sure.
Thanks.

Re: removing a struct from memory ( free() ) [Re: Rich] #315976
03/20/10 14:47
03/20/10 14:47
Joined: Dec 2008
Posts: 271
Saturnus Offline
Member
Saturnus  Offline
Member

Joined: Dec 2008
Posts: 271
"I have a pointer to a struct stored in an entity skill."

This means that my.skill[99] == pointerToStruct. The address operator is unnecessary here, as you already have the address stored in the skill. Thus it should rather read: free(my.skill[99]).

Re: removing a struct from memory ( free() ) [Re: Saturnus] #315998
03/20/10 17:11
03/20/10 17:11
Joined: Jan 2002
Posts: 300
Usa
Rich Offline OP
Senior Member
Rich  Offline OP
Senior Member

Joined: Jan 2002
Posts: 300
Usa
Ok, Thanks a lot laugh . I'll need to do some reading up on pointers, its been a while and I never quite got the full hang of them.


A8 com / A7 free

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