Jump to content

error 052: multi-dimensional arrays must be fully initialized


Recommended Posts

hello guys! someone can help me im getting an error: error 052: multi-dimensional arrays must be fully initialized, i dont know why.

 

MAX_RACE_CHECKPOINTS       6

new const Float:raceCheckpoints[MAX_RACE_CHECKPOINTS][6] =
{
	{1366.896484, 430.360900, 19.168024},
	{1323.226562, 330.576416, 18.968442},
	{1343.616943, 299.939147, 18.961088},
	{1398.594238, 272.719421, 18.965473},
        {1382.345458, 217.131347, 18.931575}
};

 

Edited by JohnGTPS
Link to comment
Share on other sites

Float:raceCheckpoints[MAX_RACE_CHECKPOINTS][6]

you need to look here, this is an 2D (2 dimensions) array, first dimension is [MAX_RACE_CHECKPOINTS] and second dimension is [6], you need to replace [6] with [3] because you use only 3 indexes of that dimension in your array, or you can let the compiler do the job by just removing 6 and let the dimension empty -> []

Edited by Sancky
Link to comment
Share on other sites

3 minutes ago, Sancky said:
Float:raceCheckpoints[MAX_RACE_CHECKPOINTS][6]

you need to look here, this is an 2D (2 dimensions) array, first dimension is [MAX_RACE_CHECKPOINTS] and second dimension is [6], you need to replace [6] with [3] because you use only 3 indexes of that dimension in your array.

if i replace the [6] with [3]  possible i get a out of bounce array.

 

Link to comment
Share on other sites

Just now, JohnGTPS said:

if i replace the [6] with [3]  possible i get a out of bounce array.

 

no, because you initialised 3 indexes, you can also just let the dimension empty [] and the compiler will put the right size for it.

Link to comment
Share on other sites

4 minutes ago, Sancky said:

no, because you initialised 3 indexes, you can also just let the dimension empty [] and the compiler will put the right size for it.

ill try to replace [6] to [3] but i get a out of bounce then ill try to empty the 2nd dimension, it didnt compile, and the compiler didnt show any symbol that not used to and the .amx file is 0kb, is there any way to fix this problem?

Link to comment
Share on other sites

1 minute ago, JohnGTPS said:

ill try to replace [6] to [3] but i get a out of bounce then ill try to empty the 2nd dimension, it didnt compile, and the compiler didnt show any symbol that not used to and the .amx file is 0kb, is there any way to fix this problem?

you won't get an out of bounds error if you put 3... , also what compiler version do you use?

Link to comment
Share on other sites

5 minutes ago, Sancky said:

you won't get an out of bounds error if you put 3... , also what compiler version do you use?

i think this is the my compiler version "Pawn compiler 3.2.3664              Copyright (c) 1997-2016, ITB CompuPhase"

and btw i've try to replace [6] to [3] and this is the result

 

Capture.PNG

Link to comment
Share on other sites

4 minutes ago, JohnGTPS said:

i think this is the my compiler version "Pawn compiler 3.2.3664              Copyright (c) 1997-2016, ITB CompuPhase"

and btw i've try to replace [6] to [3] and this is the result

 

Capture.PNG

because you are trying to access invalid indexes from that array somewhere, but the array sizes are how they should be, just don't access invalid indexes, with size 3 you have access only to 0, 1, 2.

Link to comment
Share on other sites

11 minutes ago, Sancky said:

because you are trying to access invalid indexes from that array somewhere, but the array sizes are how they should be, just don't access invalid indexes, with size 3 you have access only to 0, 1, 2.

if i make it to raceCheckpoints[0][0] to raceCheckpoints[0][3] it will be working properly?

Link to comment
Share on other sites

4 minutes ago, JohnGTPS said:

if i make it to raceCheckpoints[0][0] to raceCheckpoints[0][3] it will be working properly?

i already said, if you have an size of 3, you will have access only to 0, 1 and 2 because the indexes are starting from 0...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.