Gamestudio Links
Zorro Links
Newest Posts
Alternative to Stooq for Zorro S
by cwford. 10/09/26 21:13
Stooq now requires an API key
by cwford. 10/08/26 23:27
ZorroGPT
by TipmyPip. 10/06/26 05:32
Purchase A8 full licence version
by jcl. 10/05/26 12:12
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
3 registered members (mistery, TipmyPip, Quad), 17,751 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
JimSimons, julienp, julienper, KelleyAbbey, Yopachi
19246 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Dynamic Array Size #422094
05/02/13 06:11
05/02/13 06:11
Joined: Jul 2008
Posts: 168
8
82RJZAE Offline OP
Member
82RJZAE  Offline OP
Member
8

Joined: Jul 2008
Posts: 168
Hi, I'm not sure if I'm approaching this from the wrong direction, but I have defined a dynamic array via:

ENTITY** spawn_places = sys_malloc(sizeof(ENTITY*)*size);
where size is an integer.

Is there any way for me to determine what size spawn_places is without storing integer size?

Re: Dynamic Array Size [Re: 82RJZAE] #422099
05/02/13 07:14
05/02/13 07:14
Joined: Mar 2006
Posts: 1,993
Karlsruhe
PadMalcom Offline
Serious User
PadMalcom  Offline
Serious User

Joined: Mar 2006
Posts: 1,993
Karlsruhe
Yes:

int count = sizeof(spawn_places) / sizeof(ENTITY*);

EDIT: I was just corrected that this does not work, sorry for that! laugh

Last edited by PadMalcom; 05/02/13 07:59.
Re: Dynamic Array Size [Re: PadMalcom] #422137
05/02/13 22:38
05/02/13 22:38
Joined: Jul 2008
Posts: 168
8
82RJZAE Offline OP
Member
82RJZAE  Offline OP
Member
8

Joined: Jul 2008
Posts: 168
Does anyone know what will work?

Re: Dynamic Array Size [Re: 82RJZAE] #422138
05/02/13 22:43
05/02/13 22:43
Joined: Mar 2006
Posts: 1,993
Karlsruhe
PadMalcom Offline
Serious User
PadMalcom  Offline
Serious User

Joined: Mar 2006
Posts: 1,993
Karlsruhe
JustSid gave me the following advices:

1. option: Create an own array / list structure and save your pointers in that list. There are some examples in this forum.

2. option: Save the size parameter somewhere! laugh

Re: Dynamic Array Size [Re: 82RJZAE] #422139
05/02/13 22:43
05/02/13 22:43
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
Originally Posted By: 82RJZAE
Is there any way for me to determine what size spawn_places is without storing integer size?
No.


Always learn from history, to be sure you make the same mistakes again...

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