title: Is it safe to return a pointer to a string literal to the caller?
body: <pre><code>char* stringReturn()
  {
  char a[] = "Array of characters";
  //return a; // I know stack allocation should not be returned
  
  char *b = "Pointer to a string";
  return b; // Is it safe ? 
  } 
  
  
  int main() {    
      char *str = stringReturn ();
      cout&lt;&lt; str; 
      return 0; }
  </code></pre>
  
  <p>This is safe means then where the data "Pointer to a string" will be stored in the memory.</p>