There is nothing you could have possibly read that confirms that ASCII 0-9 corresponds to the characters 0 through 9. The digits live in characters 48 through 57, so yes '2' is 50.
There is nothing you could have possibly read that confirms that ASCII 0-9 corresponds to the characters 0 through 9. The digits live in characters 48 through 57, so yes '2' is 50.
Yes, very much because 50 is the ascii code for 2 - since you are taking "polynomial[0]" without converting it to an integer. In a trivial case where it's just one digit, you can usbtract '0' from the character, and you get the right value. But for completeness, you will probably want to use strtol (for "long int") or strtod (for "double"). These functions will also auotmatically tell you where the finished reading from the string, so you can use that to find where your next term starts (e.g. x in "x^2").
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
Thanks both.
tabstop: I actually misread this page: http://www.ssi-developer.net/reference/ascii-0.shtml, but then soon after looked at the wiki and realised.
matsp: I also read up on how polynoimal[i] would return the ascii value and not the actual digit mcontained in the char, and since my last post I have my program well underway. Alot of it, I've just been writing,testing, writing, testing etc...and have also been optimizing a bit along the way, and overall I'm enjoying my c experience.