title: converting string to a double variable in C
body: <p>I have written the following code. It should convert a string like <code>&quot;88&quot;</code> to double value <code>88</code> and print it</p>
  <pre><code>void convertType(char* value)
  {
     int i = 0;
     char ch;
     double ret = 0;
     while((ch = value[i])!= '\0')
     {
        ret = ret*10 + (ch - '0');
        i++;
     }
     printf(&quot;%d&quot;,ret); //or %lf..
  }
  
  // input string :88
  </code></pre>
  <p>But it always prints <code>0</code>. But when I change type of ret to <code>int</code>, it works fine. When the type is <code>float</code> or <code>double</code>, it  prints <code>0</code>. So why am I getting these ambiguous results?</p>