Final answer:
The consequence of deleting a pointer after accessing it and making changes is that it causes a segmentation fault.
Step-by-step explanation:
The consequence of deleting a pointer after accessing it and making changes is that it causes a segmentation fault. A segmentation fault occurs when a program tries to access a memory location that it is not allowed to access, which can happen when you delete a pointer and then try to access it afterward.
For example, consider the following code:
int* ptr = new int; // allocating memory
*ptr = 5; // accessing and modifying
delete ptr; // deleting
*ptr = 10; // trying to access after deleting
In this code, after deleting the pointer, trying to access it again using *ptr = 10; would result in a segmentation fault.