title: How to return a string literal from a function
body: <p>I am always confused about return a string literal or a string from a function. I was told that there might be memory leak because you don't know when the memory will be deleted?</p>
  
  <p>For example, in the code below, how to implement <code>foo()</code> so as to make the output of the code is "Hello World"?</p>
  
  <pre><code>void foo (       )              // you can add parameters here.
  {
  
  }
  
  int main ()
  {
      char *c;
      foo (    );
      printf ("%s",c);
      return 0;
  }
  </code></pre>
  
  <p>Also, if the return type of <code>foo()</code> is not void, but you can return <code>char*</code>, what should it be?</p>