A segmentation fault in Linux occurs at the moment your program attempts to access memory which is either not assigned by the operating system, or access is denied.
When each process on your computer has its own virtual address space, referred to as segmentation. So, when Process A reads memory location 0x877, it reads information residing at a different physical location in RAM than when Process B reads its own 0x877.
Latest operating systems support and use segmentation, and so all can produce a segmentation fault.
If you fix the code, you can get rid of the segmentation fault. It mostly occurs due to bad programming such as boundary-condition errors, incorrect pointer manipulation, or invalid assumptions about shared libraries.
Sometimes in many cases segmentation fault also occurs due to faulty hardware.