Crash or "segmentation fault" when data is copied/scanned/read to an uninitialized pointer
<p>This question is meant to be used as reference for all frequently asked questions of the nature:</p>

<p>Why do I get a mysterious crash or "segmentation fault" when I copy/scan data to the address where an uninitialised pointer points to?</p>

<p>For example:</p>

<pre><code>char* ptr;
strcpy(ptr, "hello world"); // crash here!
</code></pre>

<p>or</p>

<pre><code>char* ptr;
scanf("%s", ptr); // crash here!
</code></pre>