title: C program crashing because of invalid address
body: <p>I am not able to figure out why my program is crashing in the print statements. Pls help.</p>
  <pre><code>char *
  infix_to_postfix(char *string, int str_len, int *new_len) {
  *new_len = str_len;
  return string;
  }
  fsm_t *
  fsm_nfa_construction(char *string, int str_len) {
      int new_len;
      char *postfix_str = infix_to_postfix(string, str_len, &amp;new_len);
      // return fsm_nfa_construction_internal(postfix_str, new_len);
      printf (&quot;%s\n&quot;, postfix_str);
      return NULL;
  }
  int
  main(int argc, char **argv) {
      char str[32];
      strncpy(str, &quot;ab|*c.\0&quot;, strlen(&quot;ab|*c.\0&quot;));
      fsm_t *fsm = fsm_nfa_construction(str, strlen(str));
      return 0;
  }
  (gdb) f 2
  #2 0x0000555555556aa8 in fsm_nfa_construction (string=0x7fffffffdc20 &quot;ab|*c.&quot;, str_len=6) at fsm.c:715
  715 printf (&quot;%s\n&quot;, postfix_str);
  (gdb) p postfix_str
  $3 = 0xffffffffffffdc20 &lt;error: Cannot access memory at address 0xffffffffffffdc20&gt;
  </code></pre>