Subject: Errata - Chapter 9, Page 299, C#
Posted By: RobC Post Date: 8/28/2006 7:32:53 PM
string[,] MyArray = new string[3, 3];

should be:
string[,] MyArray = new string[4, 4];

and
string[, ,] MyArray2 = new string[3, 3, 3];

should be:
string[, ,] MyArray2 = new string[4, 4, 4];


Reply By: DaveSussman Reply Date: 8/30/2006 3:03:43 AM
These are errors; in C# arrays are declared with the number of items, but the indexing starts from 0 when you index into the array. So it's declared with 4 items, but contains items 0-3.

Interestingly, these were correct in my original chapter. I'll check the edits to see where this crept in.


Go to topic 48975

Return to index page 190
Return to index page 189
Return to index page 188
Return to index page 187
Return to index page 186
Return to index page 185
Return to index page 184
Return to index page 183
Return to index page 182
Return to index page 181