nevermind. please delete.

i don't know how to delete my post!
Last edited on
Are you using signed ints because:
-666,555,444,333,222,111 < -2^31
I don't think so. the negative is conveyed by one of the first two elements of the number's array.
I see that your storing all the didgits into an array, never mind that.
Anyway, how can you tell where your last digit is? For instance 100 + 23 (assuming i'm using positive number up to 3 digits) would look something like:
  { 0, 0, 1 }
+ { ?, 2, 3 }
_____________
  { ?, 2, 3 }
right?
So the problem is the ?, i.e. garbage data. You need to do something like c-strings do and use a "stop" int. Maybe -1 because all the digits should be 0-9. Then the arrays would look like:
  { -1, 0, 0, 1 }
+ { ?, -1, 2, 1 }
_________________
  { -1, 3, 2, 1 }
Now it knows not to read the garbage data (?).
Topic archived. No new replies allowed.