title: Why do I get a warning about printf() with %s taking type void * as parameter?
body: <p>I'm on programming project 4 from chapter 19 of <em>C programming, A Modern Approach</em>. My code works but I get this warning trying to pass a function returning a <code>void *</code> parameter to <code>printf</code> with conversion specifier <code>%s</code>.</p>
  
  <blockquote>
    <p>format <code>%s</code> expects argument of type <code>char *</code>, but argument 2 has type <code>void *  [-Wformat=]</code></p>
  </blockquote>
  
  <p>I can easily get rid of the warning by casting the return type of the function to <code>char *</code>,  like</p>
  
  <pre><code>printf("%s\n", (char *) function(param));
  </code></pre>
  
  <p>but I just want to know why this necessary since type <code>void *</code> is casted to another pointer type automatically.</p>