title: returning const char * from a function in C
body: <p>In my library I have to return a string to the callers. The string I am returning will be a global array, the intended use from the caller is just to read the string. I don't want them to modify it..</p>
  
  <p>Is this the right way to declare the function..</p>
  
  <pre><code>const char * get_some_details();
  </code></pre>
  
  <p>This should generate a warning (tried only gcc) either when the caller assigns the return value to a char * ptr or assigns to const char * ptr, but later tries to modify it.</p>
  
  <p>I am asking because I would expect functions like getenv() to return const char *. But it returns char *. Is there any gotcha in returning const char * ?</p>