Show Array
This is a warmup exercise.
It is not compulsory, and may be
completed individually or with your lab partner.
Download
showArray.c
,
or copy it into your current directory on a CSE system by running
$ cp /web/cs1511/17s2/week05/files/showArray.c .
The file showArray.c
contains a main function
which reads values into an array. You are to implement
the void showArray(int size, int array[MAX_LENGTH])
function which should print the given array like so:
[1, 2, 3]
Some Examples
Enter array size: 3 Enter array values: 1 2 3 [1, 2, 3]
Enter array size: 1 Enter array values: 17 [17]
To run some simple automated tests:
$ 1511 autotest showArray
To run Styl-o-matic:
$ 1511 stylomatic showArray.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_showArray
Or, if you are working from home, upload the relevant file(s) to the wk05_showArray activity on Give Online.