sizeof 2D array
#2

pawn Code:
sizeof(array) // First dimension
sizeof(array[]) // second dimension
sizeof(array[][]) // third dimension
In your case, the second dimension would always return 9, though, because that's the highest number of cells.
Basically, your code will compile as:

pawn Code:
new
    array1[3][9] = {
        { 1, 2, 3, 4, 5, 6, 7, 8, 9 }, // there is 9 numbers
        { 1, 2, 3, 4, 5, 0, 0, 0, 0 }, // there is 5 numbers
        { 1, 2, 3, 4, 5, 6, 0, 0, 0 }, // there is 6 numbers
    }
;
Reply


Messages In This Thread
sizeof 2D array - by zgintasz - 04.07.2012, 12:40
Re: sizeof 2D array - by Vince - 04.07.2012, 12:57
Re: sizeof 2D array - by zgintasz - 04.07.2012, 13:09
Re: sizeof 2D array - by Vince - 04.07.2012, 13:17
Re: sizeof 2D array - by zgintasz - 04.07.2012, 13:19
Re: sizeof 2D array - by Vince - 04.07.2012, 13:27
Re: sizeof 2D array - by zgintasz - 04.07.2012, 13:33
Re: sizeof 2D array - by zgintasz - 05.07.2012, 08:41

Forum Jump:


Users browsing this thread: 1 Guest(s)