title: C: what is wrong with this char pointer assignment?
body: <p>A newbie question:</p>
  
  <p>I was practice assignment to a char pointer, but found there was nothing printed out. Here is the code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main (void)
  {
      char * option_string = NULL;
      option_string = (char*)malloc(sizeof(5));
      memset(option_string, 0, sizeof(char) * 5);
  
      int j;
      for ( j = 0; j &lt; 5; j++)
      {
          *option_string++ = 'a';
      }
  
      printf("print options_string: %s\n", option_string); //!nothing was printed out!
      free(option_string);
      return 0; 
  }
  </code></pre>
  
  <p>Thanks in advance!</p>