The array count function tells you the highest numbered array item available, so looping from 0 to this number will visit every array item.
You can assign units in any order you wish - you can even leave them unassigned. Try it yourself, add unit 100 to the tile, or unit 54, or unit 77. In other words, yes, you have misinterpreted the code
If you decide to use dynamic arrays, you may have complications to deal with - if you insert or delete units, this changes the unit numbers of all units from that point in the array. I suggest that if you want to do something like this that you maintain a list of 'free' units in another array, and only expand the unit array when this list is free.
I'll expand the example to do this for you if you want - when I get home from work later today (about 6 hours)
[edit]re-reading your last point, the answer to that is no, you can't create an array of arrays (known as a jagged array), but the linked-list gives you the same features - an expandable list of units attached to the tile
I will still do the expanding unit array for this code.