ANSWERS TO EXERCISES ON POINTERS AND ARRAYS
1. x = {0, 4, 2, 3, 1}. The memory address of the 0th array
element of a is passed to the function.
2. x = {0, 4, 2, 3, 1}. Address arithmetic says that x+1 is the
memory address of array element 1 and x+4 is a pointer to array
element 4.
3. 0 1 2 Same as print3(x).
2 3 4 Same as print3(x+2). Just like array starts at element 2.
4 ? ? Out of bounds access.
4. Efficiency. Arrays can have billions of elements. The overhead
of copying them each time you call a function would be overwhelming.
It also means that you can pass a "sub-array" to a function for
processing as in the previous question.
5. None. It is a matter of style. Beginners usually prefer the first.