i was given an assignment by my prof. , but he stated that using pointer notation . the object t=of the program was to write a C++ function ReverseArray using "pointer notation" that will write out the elements of an array of int in reverse order.
his comments were
This is array notation: cout << "The int values you entered are: " << endl; for (int i = 0; i < arraySize; i++) cout << intList << endl; This is pointer notation cout <<*intList<
i have no clue of what he means so im a bit lost , but he returned my program(F) to fix and trying to get someone to explain what i did wrong
this is my code
#include <iostream>
using namespace std;
int *numList; // array of POINTERS to numbers
int arraySize = 0 ; // input area for longest possible number.
int main()
{
void ReverseArray(int* &intArray, int size);
cout << "Enter the size of the new int array: ";
cin >> arraySize;
cout << "\n"; //newline
//(array var) = new (type)[(size taken from user}]
numList = new int[arraySize];
for(int i = 0; i < arraySize; i++)
{
cout << "\nEnter the next number in the array: ";
cin >> numList[i];
}
ReverseArray(numList, arraySize);
return 0;
}//end main
void ReverseArray(int* &intArray, int size)
{
//for each element up to "size"
for (int i=size-1; i>=0; i--)
/*for(int i = 0; i < size; i++)*/
{
cout << "Element " << i << " equals: " << intArray[i] << "." << endl;
cout << numList[i] << endl; // print the numbers
}
system("PAUSE");
}