Im tryng to understand if the following code actually deletes an object from memory
during ' delete z ' what is actually deleted? does the dynamicaly created integer x get deleted? does y and z get deleted also?
Thanks!
Ive run the program and different values get output when i cout x y and z
include
using namespace std;
int main() {
int* x = new int; *x=1;
int* y = x; int* z = y;
delete z;
return 0; }
im assuming the variable x is no longer on the heap?
Aucun commentaire:
Enregistrer un commentaire