Title says it all; I am wondering if integers and unsigned integers automatically assigned to zero (0) upon declaration like so:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
bool randomFunction() {
int i;
if (i == 0) {
returntrue; //Will most modern compilers return true here?
}
else {
returnfalse;
}
}
I am just curious as I have always initialized my ints/unsigned ints variables. Would save me a lot of typing if I didn't have to do this all of the time.
I know that floats and doubles you still have to initialize.
No, they are not. It would mean additional work which is probably unneeded = loss of speed which is directly contradicts C++ pronciple do not pay for what you do not use