// ex_ch10_9.c
#include <stdio.h>
#define SIZE 4

void show_arr(const int ar[], int n);
void add_arr(const int first[], const int second[], int dest[], int n);

int main(void)
{
	const int first[SIZE] = {2, 4, 5, 8};
	const int second[SIZE] = {1, 0, 4, 6};
	int result[SIZE];

	printf("The arrays to add:\n");
	show_arr(first, SIZE);
	show_arr(second, SIZE);
	// add these
	add_arr(first, second, result, SIZE);
	printf("The result is:\n");
	show_arr(result, SIZE);
	
	return 0;
}

void add_arr(const int first[], const int second[], int dest[], int n)
{
	int i;
	
	for (i = 0; i < n; i++)
		dest[i] = first[i] + second[i];
}

void show_arr(const int ar[], int n)
{
	int i;
	
	for (i = 0; i < n; i++)
		printf("%d  ", ar[i]);
	putchar('\n');
}
