What are segmentation faults? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What are segmentation faults?

Mnay times I have experienced a problem while executing my c++ codes. The compiler never showed an error during compilation, but half way through the execution, a message "Segementation fault(core dumped)" appeared on the screen. What actually are these? Why do they occur? What can I do to avoid them?

30th Apr 2018, 4:41 AM
Suraj Kolla
Suraj Kolla - avatar
1 Answer
+ 1
segmentation fault occurs when try to access memory you don't have access to eg: int a[49]; a[50] = 12; //this causes segmentation fault
30th Apr 2018, 5:28 AM
‎ ‏‏‎Anonymous Guy