void func()
{
const int intAge = 24;
}
What happens with intAge
after you run func()
? Do you have to deallocate it, or does the C++ compiler do this?
void func()
{
const int intAge = 24;
}
What happens with intAge
after you run func()
? Do you have to deallocate it, or does the C++ compiler do this?
The storage of variables with automatic storage duration is deallocated automatically when the variable goes out of scope. This is handled by the language implementation.
In fact, there is no need and no way to manually deallocate memory of any variable. Only dynamic memory can be deallocated manually.