Array Functions

This is a pair exercise and must be competed in your tutorial or lab with your partner.

In this exercise, you’ll be creating a small collection of functions that could help you with working on arrays.

Download arrayFunctions.c, or copy it into your current directory on a CSE system by running

$ cp /web/cs1511/17s2/week05/files/arrayFunctions.c .

Start by downloading the file called arrayFunctions.c. You will need to modify this file and implement the functions.

Some unit tests have been provided in the main file. You should add your own tests to help make sure your code works properly.

Some of these functions read through an array and return some information about the array but do not change the array in any way. These functions are

Some other functions change the array values or have an effect outside the program. We say that these functions have side effects as they do something other than just return a value. These functions are

To run some simple automated tests:

$ 1511 autotest arrayFunctions

To run Styl-o-matic:

$ 1511 stylomatic arrayFunctions.c
Looks good!

You’ll get advice if you need to make changes to your code.

Submit your work with the give command, like so:

$ give cs1511 wk05_arrayFunctions

Or, if you are working from home, upload the relevant file(s) to the wk05_arrayFunctions activity on Give Online.