Two-dimensional array elements
#1

Hi, how to set all elements of two-dimensional array to specific values. If I want all sub-array elements to contain 0, 1, 2, 3, 4, and 5, how would I do it without making loops. The example below gives me error:
pawn Код:
new
    Vehicle[MAX_VEHICLES][6] =
    {
        { 0, 1, ... }, { 0, 1, ... }, ...
    };

/*
Elements should contain:

Vehicle[0][0] = 0;
Vehicle[0][1] = 1;
Vehicle[0][2] = 2;
Vehicle[0][3] = 3;
Vehicle[0][4] = 4;
Vehicle[0][5] = 5;

Vehicle[1][0] = 0;
Vehicle[1][1] = 1;
Vehicle[1][2] = 2;
Vehicle[1][3] = 3;
Vehicle[1][4] = 4;
Vehicle[1][5] = 5;

Vehicle[2][0] = 0;
Vehicle[2][1] = 1;
Vehicle[2][2] = 2;
etc...
*/
I also tried few other methods, but they too give me errors.
Reply


Messages In This Thread
Two-dimensional array elements - by Stylock - 09.01.2011, 12:25

Forum Jump:


Users browsing this thread: 2 Guest(s)