It seems this program is all about arrays and pointers.
It might be a good idea to go through the tutorial pages on those topics - it should illuminate some of the apparently mysterious parts of the code.
http://www.cplusplus.com/doc/tutorial/arrays/
http://www.cplusplus.com/doc/tutorial/pointers/
Now considering the main() function in this program.
Line 28 defines a constant - this is a bit like a variable except it cannot be changed once it has been given an initial value.
Line 29 defines an array named list2 which contains 10 individual elements of type double.
Lines 33 to 36 display a prompt and request the user enters the value to be stored in each of those array elements.
Line 38 both outputs some text and also calls the function named average() at line 16. The result of that function is also displayed.
Note. There are two functions named average(). They differ only in the parameter list (one expects an array of integers, the other an array of doubles). The compiler selects the correct one based in the type of parameters passed to it from main(). This is called
function overloading.
One interesting point is the syntax
*(array + i)
(line 21). That is using pointer syntax to access an array element. The corresponding array syntax would be
array[i]
. Both achieve the same result, accessing the
ith element of the array (counting from zero as the first element).