title: Where in memory are string literals ? stack / heap?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/2589949/c-string-literals-where-do-they-go">C String literals: Where do they go?</a>  </p>
  </blockquote>
  
  
  
  <p>As far as I know,</p>
  
  <blockquote>
    <p>generally, pointer have to be
    allocated by malloc(), and will be allocated
    to heap, then unallocated by free();</p>
  </blockquote>
  
  <p>and </p>
  
  <blockquote>
    <p>non pointer(int,char,float,etc..) will be
    allocated automatically to stack, and
    unallocated as long as the function go to
    return</p>
  </blockquote>
  
  <p>but, from following code : </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main()
  {
  char *a;
  
  a = "tesaja";
  
  return 0;
  }
  </code></pre>
  
  <p>where will <code>a</code> allocated to ? stack or heap ? </p>