title: gcc scanf warning believes float is double
body: <p>I have a question regarding a warning message from the gcc compiler. The warning message occurs when an argument of scanf isn't a pointer to the variable that should carry the user input.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main(int argc, const char *argv[]) {
      float number;
      scanf("%f", number); /* the value of 'number' is passed, instead of the adress to it */
      return 0;
  }
  </code></pre>
  
  <p>gcc will give the following warning message when it compiles the program.</p>
  
  <pre><code>scanf-problem.c: In function 'main':
  scanf-problem.c:5:5: warning: format '%f' expects argument of type 'float *', but argument 2 has type 'double' [-Wformat=]
       scanf("%f", number);
       ^
  </code></pre>
  
  <p>Like expected gcc wants the second argument of scanf to have the type 'float *' (the pointer to a float). What troubles me is that gcc believes that the second argument have the type 'double', when it actually have the type 'float'.</p>
  
  <p>Which leads me to the question, why do gcc believe the second argument of scanf to be a double, when it actually is a float?</p>
  
  <p>I have made some research on this topic to get an answer, but every answer I find is about how to get rid of the warning (write '&amp;number' instead of 'number').</p>