C Programming

Status
Not open for further replies.

kalpik

In Pursuit of "Happyness"
One tip: The ASCII value of (char) '0' is (int) 48. So just make a loop and extract these values! Also remember that you have to do the units, tens, hundred math also!

int num=0;
for(i=0;i<strlen(string);i++)
{
num=num+(((int)string-48)*pow(10,i));
}

I think the above code should work!
 
Status
Not open for further replies.
Top Bottom