Reason for Segmentation fault

The pointer may be pointing to some memory that has not been trashed yet, but is not safe.

Memory in global data is permenant, it is forever for the life of the program.

Memory on the stack is only for the life of the function in which it is declared.

Memory on the heap is dynamic, long last and can be allocated when needed and free, main issue is time it takes to allocate and free, a performance thing, and also fragmentation.