title: Trying to write a program to sum the value of an int and a char
body: <p>I am trying to write a program in C to sum the value of an integer and a character. If the user enters an integer where the character should be, I am expecting my program to calculate the value of the 2 integers. My code below works with the user entering 2 integers but only calculates up to 9 (Ex: 4 5: "Character '4' represents a digit. Sum of '4' and '5' is 9"). If the user enters 5 6, the result is: "Character '5' represents a digit. Sum of '5' and '6' is ;". I have been searching for a while now and any potential solution always leads to the incorrect sum. I also expect my program to accept user input higher than '9' (Ex: 20 50), but if I change '9' to '99', I get the following warning: "warning: multi-character character constant [-Wmultichar]". Can someone please point me in the right direction to achieve these goals?</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  int sum (int m, char n){
      return m+n;
  }
  
  int main(){
      char ch;
      int c;
      printf("Enter an integer and a character separated by a blank&gt; ");
      scanf("%d %c",&amp;c, &amp;ch);
      if((c &gt;= '0' &amp;&amp; c &lt;= '9')||(ch &gt;= '0' &amp;&amp; ch &lt;= '9')){
          int cs = sum(c, ch - 0);
          printf("Character '%d' represents a digit. Sum of '%d' and '%c' is %d" , c, c, ch - 0, cs);
      }
      return 0;
  }
  </code></pre>