Programming Exercises

  1. Modify the rain program in Listing 10.12 so that it does the calculations using pointers instead of subscripts. (You still have to declare and initialize the array.)

  2. Write a program that initializes an array and then copies the contents of the array into two other arrays. (All three arrays should be declared in the main program.) To make the first copy, use a function with array notation. To make the second copy, use a function with pointer notation and pointer incrementing. Have each function take as arguments the name of the source array, the name of the target array, and the number of elements to be copied.

  3. Write a function that returns the largest value stored in an array. Test the function in a simple program.

  4. Write a ...

Get C Primer Plus®, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.