Hello,
I have a program assignment that I have no idea what it's asking for honestly. I've tried to read all I can about it, but I do not understand. I tried my hand at some code, but it's only returning the address of course.
Here is my attempted code:
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
int main()
{
int a[5];
int (*ptr_array)[5];
for (int i = 0; i < 5; i++)
{
cout << "Enter array value: " << endl;
cin >> *ptr_array[i];
}
cout << "The beginning of the array is: " << ptr_array << endl;
return 0;
}
Here are the instructions:
Write a program that defines an array of integers and a pointer to an integer. Make the pointer point to the beginning of the array. Then, fill the array with values using the pointer (Note: Do NOT use the array name.). Enhance the program by prompting the user for the values, again using the pointer, not the array name. Use pointer subscript notation to reference the values in the array.
Mind you I'm in a beginning C++ class so please no advanced programs, I can only use the techniques that have been taught so far, which is up to basic level pointers. Thanks!