Array or array element in C?

Posted by user3646717 on Stack Overflow See other posts from Stack Overflow or by user3646717
Published on 2014-06-06T03:00:41Z Indexed on 2014/06/06 3:24 UTC
Read the original article Hit count: 232

Filed under:
|
|

I'm reading a book about C programming, and I'm not sure whether there is an error in the book or not. Its about arrays and has the following array example:

enter image description here Then it says:

The following statements sets all the elements in row 2 of array to zero: for( column = 0; column <= 3; column++) a[ 2 ][ column ] = 0;

The preceding for statement is equivalent to the assignment statements: a[ 2 ][ 0 ] = 0; a[ 2 ][ 1 ] = 0; a[ 2 ][ 2 ] = 0; a[ 2 ][ 3 ] = 0;

Shouldn't it say "The following statements sets all the elements in row 1 to zero"?. Because if I say a[ 3 ] I am talking about the row 2, if I say a[ 2 ] I am talking about row 1 and if I say a[ 1 ] I am talking about row 0.

© Stack Overflow or respective owner

Related posts about c

    Related posts about arrays