For example .
When a function, that has a local integer variable x, ends, what does C++ do to the value stored at memory location corresponding to x?
Does it insert a random value?
This very much depends on the implementation.
In most cases nothing is done. You simply mark the memory as unused during deallocation, you don't actually do anything to the memory in this case.
In some very obscure cases you may find different things done. In one example, the RTOS RTEMS can be set up to write to the memory in dealocation. It might write something specific like
0xDEADBEEF. This can be helpful when debugging memory issues in these RTOS systems because it is easy to identify when you are using bad memory. But this is very rare.