title: what's the output of following code and why?
body: <p>The following code is an interview qusetion and I can't understand the output. Can anyone help? Thanks.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
      char* string_1()
      {
         char* p = "ABCD";
         return p;
      }
  
      char* string_2()
      {
         char p[] = "ABCD";
         return p;
      }
  
      int main(void)
      {
         printf("%s\n",string_1());
         printf("%s\n",string_2());
      }
  </code></pre>