>>I'd modified the example
Ahh, I see. I should've read code closer
>>a simple 5 liner code
Dude, your cut/paste is up the spout, there's a brace missing from that snippet!
Segmentation Fault: I am an error in which a running program attempts to access memory not allocated to it and core dumps with a segmentation violation error. This is often caused by improper usage of pointers, attempts to access a non-existent or read-only physical memory address, re-use of memory if freed within the same scope, de-referencing a null pointer, or (in C) inadvertently using a non-pointer variable as a pointer.