sizeof 2D array
#7

Thanks! It works fine if I put 0 in the element end. Is it possible without 0(zero)?
pawn Code:
new
    array1[ ][ ] = {
        { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 }, // there is 9 numbers
        { 1, 2, 3, 4, 5, 0 }, // there is 5 numbers
        { 1, 2, 3, 4, 5, 6, 0 } // there is 6 numbers
    }
;
EDIT:
if the array is with Float tag, strlen gives tag mismatch :
pawn Code:
new
    Float:array1[ ][ ] = {
        { 1.1, 9.8, 2.5, 0.0 }, // there is 3 numbers
        { 1.6, 5.1, 0.0 }, // there is 2 numbers
        { 1.2, 5.3, 6.0, 5.3, 0.0 } // there is 4 numbers
    }
;
printf( "%d", strlen( array1[ 0 ] ) ); // tag mismatch
printf( "%d", strlen( array1[ 1 ] ) ); // tag mismatch
printf( "%d", strlen( array1[ 2 ] ) ); // tag mismatch
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)