For Example
a[]={1,0,0,0,0,0,0,0,0,0...........0}
+ b[]={2,0,0,0,0,0,0,0,0,0...........0}
________________________________
c[]={3,0,0,0,0,0,0,0,0,0...........0}
Plz Help Me.
These are not strings, but arrays of, presumably, `int`s.
Loop through them and add corresponding elements. Try to express that
in C, and if you have problems, come here for help. I doubt many
people here are willing to do your homework for you, and even if they
did, ask yourself whether it's going to do anything for your
knowledge. You are after knowledge, aren't you?
--
For large values of one, one equals two, for small values of two.
I read string addiction
Addition's carry is either 0 or 1 (unless you're doing something
weird). Carry only occurs when all the terms are greater than the
maximum value. Putting all of this together:
T a[n], b[n], c[n+1];
...
T carry = a[i] + b[i] + oldcarry > maxvalue;
The above only works with math's unlimited range integers but not in
C's fixed range of integers (unless maxvalue is much less than T_MAX).
The way to work around this is to promote to a larger type (if one is
even available) or my preferred way of rearranging the terms:
T carry = a[i] > (maxvalue - oldcarry) - b[i];
If T is an unsigned integer, you can use (T)-1 for maxvalue, otherwise
you have to #include <limits.h> and use T_MAX.