vendredi 29 décembre 2017

Initializing arrays, potentially unforseen consequences?

I've recently observed that by initializing an array, the garbage values are all replaced by null terminators. This would appear to be inconsequential, but in a large program I don't think it would be preferable to spend resources on cleaning out an array. Now to be clear, I don't program large programs, that's why I'm asking, I'm just a beginner. However, when used properly, it would stand to reason that garbage values would be perfectly fine as long as there is always an explicitly placed terminator.

So then, should I take it as bible to always initialize my arrays, or should I consider whether I can get away with leaving the garbage values untouched?

Aucun commentaire:

Enregistrer un commentaire