you should spell length properly , also you should use code tags to post your code, it is easier to read. And start your own thread to get help rather than jumping in to an older post to get more attention to your problem rather than the problems from the older post that have already been taken care of.
mike ryan wrote:you should use code tags to post your code, it is easier to read. And start your own thread to get help rather than jumping in to an older post
Agreed. i took care of both.
Julia - next time, please use code tags. They make your code much easier to read, assuming your code is formatted with proper indentation. They work the same way as the 'italic' or 'color=red' tags work. Simply highlight it and click the 'code' button.
Personally, i wouldn't have these three lines at all:
but would instead do this:
My reasoning is that
1) it is possible that in between getting the length and using it, your array could change. Granted, not with the code you have here, but it is possible.
2) why store the same value twice? You can get the length(s) whenever you need it, so why get it and store it again? It's just redundant data.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors