Quote:
Originally Posted by
omega666
sorta unrelated question:
if you have an array that not all elements have been put in
Please don't use netspeak. We really discourage it here; and if you know what "you" means, you also know how to spell it!
What do you mean by 'put in'? And what kind of array, anyway?
Quote:
and you do a for loop for it, will it crash if it tries to access one of the elements that doesn't have anything in it?
Depends what it is and what you're doing with it. An array of integers may have unpredictable values if you never put anything in it before you used it, but won't crash in of itself. (Of course, the things you do with unexpected numbers may cause it to crash, but that's neither here nor there.) An array of pointers may be full of garbage pointers aimed at nowhere in particular which will crash if you dereference them. Or, worse, they may be pointers to VALID if unintended memory, which will do bizzare unpredictable things instead of crashing.
But in any of these cases it's not the array that's crashing -- it's what you do with the values you find in it.