title: How to satisfy the warnings about incompatible types on printf()
body: <p>I am going through the tutorials on learn-c.org. Coming up to the section about <a href="https://www.learn-c.org/en/Arrays_and_Pointers" rel="nofollow noreferrer">Arrays and Pointers</a>, the first two lines of the example program issue a warning if I run them on my system:</p>
  
  <pre class="lang-c prettyprint-override"><code>char vowels[] = {'A', 'E', 'I', 'O', 'U'};
  char *pvowels = &amp;vowels;
  </code></pre>
  
  <p>The code runs, but I get the following warning:</p>
  
  <blockquote>
    <p>warning: initialization of ‘char *’ from incompatible pointer type ‘char (*)[5]’ [-Wincompatible-pointer-types]
       15 |  char *pvowels = &vowels;</p>
  </blockquote>
  
  <p>I can get rid of this warning if i cast it as </p>
  
  <pre class="lang-c prettyprint-override"><code>char *pvowels = (char *) &amp;vowels;
  </code></pre>
  
  <p>But is that the correct way to approach that warning, just to cast it? It seems unnecessary in the first place, i don't really understand the difference between <code>char *</code> and <code>char (*)</code>.</p>
  
  <hr>
  
  <p>Next, the <code>printf</code> line issues a warning for the 3rd argument, saying: </p>
  
  <blockquote>
    <p>warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 3 has type ‘char *’ [-Wformat=]</p>
  </blockquote>
  
  <p>(same for arguments 5 and 7)</p>
  
  <p>This one i don't even know how to cast in order to bypass the warning... What would be the correct way to print this one?</p>
  
  <hr>
  
  <h3>Entire program from their tutorial for reference:</h3>
  
  <pre class="lang-c prettyprint-override"><code>char vowels[] = {'A', 'E', 'I', 'O', 'U'};
  char *pvowels = &amp;vowels;
  int i;
  
  // Print the addresses
  for (i = 0; i &lt; 5; i++) {
      printf("&amp;vowels[%d]: %u, pvowels + %d: %u, vowels + %d: %u\n", i, &amp;vowels[i], i, pvowels + i, i, vowels + i);
  }
  
  // Print the values
  for (i = 0; i &lt; 5; i++) {
      printf("vowels[%d]: %c, *(pvowels + %d): %c, *(vowels + %d): %c\n", i, vowels[i], i, *(pvowels + i), i, *(vowels + i));
  }
  </code></pre>