What is a segmentation fault in C/C++ program?

C++CServer Side ProgrammingProgramming

A segmentation fault occurs when your program attempts to access an area of memory that it is not allowed to access. In other words, when your program tries to access memory that is beyond the limits that the operating system allocated for your program.

Segmentation faults are mostly caused by pointers that are:

  • Used to being properly initialized.

  • Used after the memory they point to has been reallocated or freed.

  • Used in an indexed array where the index is outside of the array bounds.

raja
Published on 28-Mar-2019 13:21:49
Advertisements