# Instructions

Create a separate file (source code) for every exercise and name it according to the exercise number (e.g. Exercise 2-1.c). The answers to the advanced questions can be included as a separate function in the original file for the exercise it belongs to.

Zip all the files and submit it via Google Classroom.

Naming Convention for the zip file: [Last Name], [First Name] - Array and String Exercise.zip

classroom code : 6rfue3e

# Passing Parameters to Arrays

Remember, arrays can only be processed on a PER ELEMENT BASIS. This will be important when we discuss passing arrays as parameters to functions. When parameters are passed to functions as pass by value, you normally copy the value of the variable into the parameter, However, as stated, this cannot be done for arrays…

Therefore, in order to pass arrays as parameters, we have to pass the BASE ADDRESS of the array instead, then use POINTER DEREFERENCING to access the elements of the array. Harkening back to dynamic lists, to perform this properly, we must also pass the number of elements of the array into the function.

There is indeed an easier way to pass arrays as parameters. We can use the ARRAY INDEXING notation in parameters too! To do this, we have to declare an array parameter by using the following syntax for the parameter:

    return_type function_name (array_type parameter_name[], ...)

So how do we determine the size of the array parameter? Well, we have to pass it as a parameter as well:

    return_type function_name (array_type parameter_name[], int size, ...)

## Exercise

Write a function that will compute for the average of all the elements of an integer array.

Advanced (Bonus Points): Instead of the average, instead compute the standard deviation ($$\sigma$$) of the array. Use the following formula:

$\sigma = \sqrt{\frac{\sum_i^n{(x_i - average)^2}}{n - 1}}$

where $$x_i$$ denotes the $$i^{th}$$ element and $$n$$ denotes the total number of elements.

## Exercise

Write a function that determines whether a character array of is a palindrome or not. Return 1 if the array is, otherwise return 0. An array is a palindrome if, after reversing its contents, you get the same array.

Advanced (Bonus Points): Determine instead if another character array is an anagram of the character array.