'Do wild pointers truly point to a random value, or is that just shorthand for some value that will crash the program?

I've learned about wild pointers and how to avoid them. I've heard that they point to a random value in memory and I was wondering if they actually have a random and completely irrelevant value or if they point to a certain value that's probably implementation dependent. Which is it?

c


Solution 1:[1]

These dangling pointers are not random in the "mathematical" sense. They point to an implementation dependent location (based on hardware arch, runtime sequence, etc), that your program isn't supposed to have access to & the content of the pointed location is undefined from your program's point of view. The operating system is free to re-allocate & write whatever whenever so your pointer to that memory is deemed "random" in its value.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 eliangius