Heap memory is a memory that is not bounded by the scope and remains even when the variable goes out of scope. So is it like global variable?
int* create(){
int *a = new int(5);
return a;
}
int main(){
fastIO;
int *b = create();
cout << *b << endl;
cout << *a << endl;
}
Now in this program, both the cout must give output but its shows compilation error that *a is not declared