CpSc 246
Assignment 3: Pointers
20 Points


The objective of this assignment is to
  1. use pointers,
  2. pointer arithmetic, and
  3. dynamic memory

Write a program that uses a function to reverse a list of integers. The function is to receive a pointer to the first item along with the number of items and use pointer arithmetic to access the items. Arrays are NOT permitted in the function.

In the main program

  1. declare a large array of 100 integers.
  2. Request the user to enter numbers and insert them into the array in order.
    • The user can enter anywhere from 3 to 100 numbers.
    • You cannot use array notation to insert the number into the "array"
    • You must use pointer arithmetic
  3. Call the reverse function with the address of the first element (i.e., a pointer) and the number of items the user entered.
    • The only declaration permitted in the function is a temporary that is declared as a POINTER to an integer
    • The function will reverse the items
    • You cannot use array notation to swap numbers
    • You must use pointer arithmetic
  4. The main program is to print the reversed numbers using pointer arithmetic to access them.

Submit the cpp file and a screen shot of your program's output in Eclipse to the D2L Pointer dropbox.