After deleting ptr, does cout << ptr
print the address of int(6)
?
If so, why is it garbled? I remember that delete
only releases the data in the specified space, isn't it?
And I would like to ask when the delete
releases space data here, is it only to release 6
or even the int
type?
int* ptr = new int(6);
cout << "Address of the space pointed to by ptr: " << ptr << endl;
cout <<"the value of the space pointed to by ptr: "<< *ptr << endl;
delete ptr;
cout << ptr << endl;