segmentation fault core dumped in c code example

Example 1: segmentation fault (core dumped) ubuntu

See AU: What is a segmentation fault? post and also this post which have some examples how reproduce it, SO: What is segmentation fault?.

The simplest description I can come with (may be not the perfect):

Example 2: Segmentation fault (core dumped)

Core Dump/Segmentation fault is a specific kind of error caused by 
accessing memory that “does not belong to you.” 
In C++ this can be caused by:
~Accessing an address that is freed
~Accessing out of array index bounds
~Stack Overflow
~Dereferencing uninitialized pointer

Tags:

Cpp Example