Code:
void Obj::func()
{
int *a = new int(1);
p = a;
}
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
void Obj::func()
{
int *a = new int(1);
p = a;
}
ya i know if an address was previously allocated to p that it should be deallocated before reassign p, this was just a quick example as i sometimes get hypothetical pointer questions while i code
...
int* p = new int(1);
int* a = new int(1);
p = a;
...
int* p = new int(1);
delete[1] p;
int* a = new int(1);
p = a;