title: char pointer initialization in C
body: <p>I am not so clear on character pointer and how they work.</p>
  
  <p>The program builds, but crashes when I run it.</p>
  
  <pre><code> char *ab = NULL;
   //ab = "abc123"; // works fine
   sprintf(ab, "abc%d", 123); // this line seems to crash the program
  </code></pre>
  
  <p>I don't get how this can be wrong, when sprintf takes in a (char * str) as a first argument.</p>
  
  <p>Can anyone please explain this to me?</p>