UC3M

Telematic/Audiovisual Syst./Communication Syst. Engineering

Systems Architecture

September 2017 - January 2018

2.7.4.  Array manipulation

Work Plan

In this exercise you will calculate the average between every pair of integers of two arrays. You will have to print the integers of the arrays and calculate and print that average. Create a file with name basic_arrays.c in your development environment and implement the following functionality:

  1. A function that prints out the integer values of an array: void print_array(int array[]);

  2. A second function that calculates the average between the two elements in a same position of two arrays and prints that average value: void calculate_average(int array1[], int array2[]);. For the first position in every array, sum the two integers and divide the result by two, prints the result out and makes the same for the rest of positions in the arrays.

  3. A main function that declares and initializes the two arrays with 10 integers (whatever you want), such as int array1[] = {1,5,7,3,12,...};, and that makes use of the first and second function to both print the values of the arrays and print out the averages.

When finished, show the file to the professor.