convert character integers to integers

I was writing a programme which required a input of a number with a ? in between.
You need to find the missing digit such that the number fulfilled certain criteria.
So I took a char array to get the input. however if i try to perform any calculations with the digits of the numbers it performs using their ascii values.
for eg.

char no[20];
gets(no);
cout<<no[1]+no[2];


for the input 1234?5678
the output i get is 101 instead of 5

how to make it use the real values
no[1]-'0' gives the digit contained in position 1
(we substract the ASCII code of 0 from the character in position 1)
Thats helpful...thanks a lot JewelCpp..but i was hoping aint there any other way to do it...actually to convert a character to an ascii value we simply put (int) before it.....i was thinking there must be something like an opposite to it which could do the work...but seems like there isnt....thanks!!
Topic archived. No new replies allowed.