title: Conversion from char to int and printing the decimal value
body: <pre><code>char str[20];
  printf("Enter anything\n");
  scanf("%s",str);
  for(int i = 0 ; i&lt;strlen(str) ; i++)
  {
     if( isdigit(str[i]))
        printf("%d",(int)str[i]);
  }
  </code></pre>
  
  <p>I tried with the above code but the output is in ASCII values of the numbers rather then actual numbers.
  Like , input: "0" output: "48".</p>
  
  <p>When I try <code>(int)(str[i]-'0');</code> instead of <code>(int)str[i]);</code> , I get the correct answer but I don't understand why it's correct.</p>