Array Maximum

This is a warmup exercise. It is not compulsory, and may be completed individually or with your lab partner.

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

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

The file array.c contains a main function which reads values into an array. You are to implement the int arrayMax(int size, int array[MAX_LENGTH]) function which should return the largest value in the array.

Some Examples

Enter array size: 5 
Enter array values: 1 2 3 4 5
Maximum value is 5.
Enter array size: 6 
Enter array values: -1 -3 -9 -17 -2 -8
Maximum value is -1.

To run some simple automated tests:

$ 1511 autotest arrayMax

To run Styl-o-matic:

$ 1511 stylomatic arrayMax.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_arrayMax

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