CS 151                                                              Spring 2015


                      Exercise:  Arrays and Functions

                      
1.  Declare list[] an array of five integer elements initialized to zeros.


2.  Code then invoke the void function fillArray() to fill list[] with values
    from console input. Parameters for this void function are to be the int 
    list[] and the int listSize representing the number of elements in list[]. 
    Since arrays are passed by reference, list[] in the calling function will
    be modified by fillArray().







3.  Create, then invoke the void function printArray() which is to display 
    each value in the int parameter list[]. When there is no need to modify an
    array such as list[], place the keyword const before this parameter
    to specify list[] values will not be changed. 






4.  Create sumArray() to find and return the int sum of list[] elements.
    Its formal parameters are to be list[] and listSize. Use const before
    list[] to indicate no change. Invoke sumArray().






5.  Make a void function named copyArray() to copy list[] into newList[]. 
    Parameters are the intS list[], newList[] and the scalar listSize. 
    Call copyArray(), then call printArray(). Neither lists are to be 
    changed.
    





6.  Code an int function named indexMinElement() to locate and return the
    index of the minimum element value in newList[]. Parameters are to be 
    the intS newList[] and listSize. Invoke indexMinElement(), swap the 
    return value with the value in newList[0], then call printArray() to
    display newList[]. (Later this will be the core code for a selection
    sort.)