#include <iostream>
int* dont() {
int num = 10;
int* num_ptr = #
return num_ptr;
}
int main() {
int* a = nullptr;
a = dont();
std::cout << *a;
}
This is my code sample. I think 'a' would have garbage value, but memory is still alive. I cannot understand what it is, please help me ! (I use visual studio 2022 for my IDE)
- precisely what i want to know is pointer 'a' must be dangling pointer. But it wasnt. I cannot understand this situation..