sizeof 2D array
#3

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
    }
;
printf( "%d", sizeof( array1 ) );
printf( "%d", sizeof( array1[] ) );
printf( "%d", sizeof( array1[][] ) );
It prints 3, 9 and 1, but should print 9, 5 and 6. But if it'll return correct numbers, I can't use this. This is what I want to make:

pawn Code:
new
    index = 0,
    count
;
count = /* somehow count how many numbers there is in element in array. The best way would be "sizeof( array1[ index ]", but it gives errors */
for( new i; i < count; i++ )
{
    //...
}
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)