Gamestudio Links
Zorro Links
Newest Posts
Help!
by VoroneTZ. 10/14/25 05:04
Zorro 2.70
by jcl. 10/13/25 09:01
ZorroGPT
by TipmyPip. 10/12/25 13:58
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 10/11/25 18:45
Reality Check results on my strategy
by dBc. 10/11/25 06:15
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (AndrewAMD, Quad, 1 invisible), 8,440 guests, and 10 spiders.
Key: Admin, Global Mod, Mod
Newest Members
joenxxx, Jota, krishna, DrissB, James168
19170 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
how to initialize a variable array? #405967
08/11/12 18:22
08/11/12 18:22
Joined: Jul 2011
Posts: 69
P
pjotr987 Offline OP
Junior Member
pjotr987  Offline OP
Junior Member
P

Joined: Jul 2011
Posts: 69
so now i try to initialize a variable array like this:

int amount=6;
int test_array[amount];

but it seems not to work

someone has a solution?

thanks in advance

Re: how to initialize a variable array? [Re: pjotr987] #405969
08/11/12 19:05
08/11/12 19:05
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
Hi

Code:
int amount = 6;
int *test_array = sys_malloc ( sizeof(int) * amount );



Salud!

Re: how to initialize a variable array? [Re: pjotr987] #405970
08/11/12 19:16
08/11/12 19:16
Joined: Sep 2009
Posts: 1,032
Budapest
Aku_Aku Offline
Serious User
Aku_Aku  Offline
Serious User

Joined: Sep 2009
Posts: 1,032
Budapest
I think you wanted to write declare instead of initialize.
txesmi sent to you a correct reply how to declare an array.
You shouldn't forget to initialize it, after the declaration.

Re: how to initialize a variable array? [Re: Aku_Aku] #405978
08/11/12 23:18
08/11/12 23:18
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
Originally Posted By: Aku_Aku

You shouldn't forget to initialize it, after the declaration.


it initializes the array too.

Re: how to initialize a variable array? [Re: txesmi] #405982
08/12/12 00:28
08/12/12 00:28
Joined: Jul 2011
Posts: 69
P
pjotr987 Offline OP
Junior Member
pjotr987  Offline OP
Junior Member
P

Joined: Jul 2011
Posts: 69
thank u very much it works perfectly!
thanks again

Re: how to initialize a variable array? [Re: txesmi] #406020
08/12/12 19:19
08/12/12 19:19
Joined: Sep 2009
Posts: 1,032
Budapest
Aku_Aku Offline
Serious User
Aku_Aku  Offline
Serious User

Joined: Sep 2009
Posts: 1,032
Budapest
Hmm... Thanks.


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