1. ## array question

Hi, I got a question. If i have an array of five cells, each storing a single digit number, and another array of the same, how can i add both arrays so that the sum is stored in an array of six cells? If there is no carry, then sum[0] must hold a zero.

eg.
integer1={4,5,0,7,1}
integer2={9,2,9,8,7}
sum={1,3,8,0,5,8}

2. Code:
```integer1[6]={0,4,5,0,7,1}
integer2[6]={0,9,2,9,8,7}
sum[6]={1,3,8,0,5,8}```
Consider what integer1[i] + intege2[i] is

Then consider what it means if that result is >= 10

Then think about a for loop

3. If you just want to sum 2 numbers, an array is an awkward way to do it. You would have to walk through both arrays in reverse order, and keep a carry. Let us know if you need more info.

4. Code:
```#include "stdio.h"
int main()
{
int var=0;
int integer2[6]={0,9,2,9,8,7};
int sum[6] = {0,0,0,0,0,0};
printf("The sum array is: ");
while(var<6)
{
sum[var] = integer1[var]+integer2[var];
printf("%d ",sum[var]);
var++;
}

return 0;
}```

5. Thanks for all the help guys, i got it.