Memory Management (cont)
If an uninitialised or otherwise invalid pointer is used, or an array is accessed with a negative or out-of-bounds index, one of a number of things might happen:
- program aborts immediately with a "
segmentation fault "
- a mysterious failure much later in the execution of the program
- incorrect results, but no obvious failure
- correct results, but maybe not always, and maybe not when executed on another day, or another machine
The first is the most desirable, but cannot be relied on.
|