title: Why can't I convert 'char**' to a 'const char* const*' in C?
body: <p>The following code snippet (correctly) gives a warning in C and an error in C++ (using gcc &amp; g++ respectively, tested with versions 3.4.5 and 4.2.1; MSVC does not seem to care):</p>
  
  <pre><code>char **a;
  const char** b = a;
  </code></pre>
  
  <p>I can understand and accept this.<br>
  The C++ solution to this problem is to change b to be a const char * const *, which disallows reassignment of the pointers and prevents you from circumventing const-correctness (<a href="http://www.parashift.com/c++-faq-lite/const-correctness.html#faq-18.17" rel="nofollow noreferrer">C++ FAQ</a>).<br></p>
  
  <pre><code>char **a;
  const char* const* b = a;
  </code></pre>
  
  <p>However, in pure C, the corrected version (using const char * const *) still gives a warning, and I don't understand why.
  Is there a way to get around this without using a cast?</p>
  
  <p>To clarify:<br>
  1) Why does this generate a warning in C?  It should be entirely const-safe, and the C++ compiler seems to recognize it as such.<br>
  2) What is the correct way to go about accepting this char** as a parameter while saying (and having the compiler enforce) that I will not be modifying the characters it points to?
  For example, if I wanted to write a function:</p>
  
  <pre><code>void f(const char* const* in) {
    // Only reads the data from in, does not write to it
  }
  </code></pre>
  
  <p>And I wanted to invoke it on a char**, what would be the correct type for the parameter?</p>