Here is an image with program working:
Why, when I delete one of the pointers that point at a memory location, I can change the value in another one without error? Why does the address of the deleted pointer change? I read on the Internet that the address shouldn't change after a delete. Does it depend on the compiler?
int* ptr = new int(7);
int* _ptr = ptr;
cout << ptr << '\n'; //print - 00CE4ED0
delete ptr;
cout << ptr << '\n'; //print - 00008123
cout << *_ptr << '\n'; //in this moment cout<<*_ptr; give garbage insdead of error . WHY?!
*_ptr = 10;
cout << *_ptr << '\n'; //print 10