#include <stdio.h>
/* DO NOT TRACE this program, just show the output produced */
/*
 *  Adds corresponding elements of arrays ar1 and ar2, storing the result in
 *  arsum.  Processes first n elements only.
 *  Pre:  First n elements of ar1 and ar2 are defined.  arsum's corresponding
 *        actual argument has a declared size >= n (n >= 0)
 */
void
add_arrays(const int ar1[],   /* input -                       */
           const int ar2[],   /*    arrays being added         */
           int       arsum[], /* output - sum of corresponding
                                       elements of ar1 and ar2    */
           int          n)       /* input - number of element
                                       pairs summed               */
{
      int i;

      /* Adds corresponding elements of ar1 and ar2               */
      for  (i = 0;  i < n;  ++i)
      {
          arsum[i] = ar1[i] + ar2[i];
      }   
}

void show(int n[])
{
    int i;
    for (i = 0; i < 6; i++)
    {
        printf("%d ", n[i]);
    }
    printf("\n\n");
}

int main(void)
{
    int c[6] = {3,7,5,3,5,7};
    int d[6] = {3,5,7,7,5,3};
    int e[6] = {2,4,6,2,6,4};

    
    add_arrays(c, d, e, 6);
    show(e);   

    add_arrays(c, d, e, 7);
    show(e);   

    add_arrays(c, d, e, 5);
    show(e);   

    add_arrays(e, d, c, 6);
    show(c);   

    add_arrays(c, c, c, 6);
    show(c);   

    add_arrays(c, d, e, d[0]);
    show(e);   

    add_arrays(&c[2], &d[2], &e[2], 4);
    show(e);   

    return 0;
}