When I started learning to program in c + + (I think one never ends) taught me to always be initialized to zero or some other value variables, because if not, can take values that could ruin rare our program.
Let's see if the legend is true:
Well, with my compiler it is, an uninitialized variable takes values rare. But if you have set in my programs, I always initialize my variables, why? Because it is not always necessary.
The rule is quite simple: "If the first statement in which we use our variable assignment is not necessary to initialize it." For example:
We can continue initializing all the variables we use, but if necessary we initialize only going to give the impression that we know what we're doing XD
0 comments:
Post a Comment