Let's say I have the following code:
#include <iostream>
void f() {
int arr[10];
}
int main() {
f();
f();
}
Does the array arr get deallocated once we leave the scope of f(), even though we will call it again? Also, if we only call f() once, I'm assuming it gets deallocated when leaving the scope of f(), but someone please correct me if I'm wrong.
I also realize that this may be compiler-related question so I've included g++ as a tag. Thanks.