4.9. Common Errors

4.9.1. Illegal index

This comes from trying to access an index that doesn't exist in the array. For instance, if you have an array of 5 elements, the valid indexes are 0 through 4. If you attempt to access index -1 or index 5, then you'll see this error because you're probably overstepping the bounds of the array.

This often happens in for loops or while loops where the terminating condition is incorrect. Verify that your loop starts at a valid index and ends at a valid index.

4.9.2. Indexing on illegal type

This can come from not initializing your array. For example, this is an uninitialized array:

  string *names;

In that line, you've created a variable called "names" of type "string *", but it has no value. Until you've given it a value, you can't operate on it.