in the following:
void myfunction() {
int a;
for (a=0;a<10;a++)
cout << a;
}
a wouldn't be released from memory until the end of the function, right?
but in this:
void myfunction() {
for (int a=0;a<10;a++)
cout << a;
}
the a would get released when the loop was completed, right?
This is according to my teacher, and I never learned it on my own, so I just want to check to confirm this.
void myfunction() {
int a;
for (a=0;a<10;a++)
cout << a;
}
a wouldn't be released from memory until the end of the function, right?
but in this:
void myfunction() {
for (int a=0;a<10;a++)
cout << a;
}
the a would get released when the loop was completed, right?
This is according to my teacher, and I never learned it on my own, so I just want to check to confirm this.