title: Why does my function produces a Conflicting Types error?
body: <p>I tried to reproduce the function atof() from the C language book without looking at it, i wrote it and every line of code seemed to be right, but when I compile the program it tells me that there is a conflicting type error .</p>
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;ctype.h&gt;
  
  float atof(char s[]); // the error is produced here
  
  int main()
  {
      char line[100] = &quot;672&quot;;
      float num = atof(line);
  
      printf(&quot;%f&quot;, num);
      return 0;
  }
  
  // I didn't finish the function yet...
  float atof(char s[])
  {
      int i, sign;
      float n;
      for(i = 0; s[i] == ' '; i++)  // skip white spaces
          ;
      // set sign to the -1 if it is negative, 1 if else
      sign = (s[i] == '-') ? -1 : 1;
      if(s[i] == '+' || s[i] == '-')
          i++;
      for(n = 0.0; isdigit(s[i]); i++)
      {
          n = 10.0 * n + (s[i] - '0');
      }
      return n * sign;
  }
  </code></pre>
  <p><strong>What I tried :</strong></p>
  <ul>
  <li>I thought that the problem occurred because this function already exists in one of the libraries that I included, so I changed it name to strtof() and the problem was the same .</li>
  <li>I tried to change the type of the function instead but the problem was still there .</li>
  <li>I tried to return a float <code>return 2.5F</code> and double <code>return 2.5</code> but that didn't solve the issue .</li>
  </ul>
  <p>( btw I use gcc compiler version 9.2.0 )</p>