Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please help me with fixing [x] I am receiving a respond that it is undefined. Al

ID: 3647795 • Letter: P

Question

Please help me with fixing [x] I am receiving a respond that it is undefined.

Also am I following the instruction. I am just not sure.


//Write a function that dynmamically allocates an array of integers. The function should accept an intergers argument indicating the
//number of elements to allocate. The function should return a pointer to the array..

#include <iostream>
using namespace std;


int main ()
{

int numbers; //number to represent the integers
int* arrays = NULL; //point to other arrays

cout << "Enter the number of elements:";
cin >> *arrays;
arrays = new int[numbers]; //Memory allocation

for (int x = 0; x < numbers; x++)
cout << "Enter a number to represent child age:"<< endl;
cin >> *arrays[x];

delete [] arrays;

return 0;


}





Explanation / Answer

I'm not really much of a programmer, but checking the code, i think you made a mistake in using the for loop: you're asking for input, but only putting it once. You should include braces { } for the body of the loop. So for (int x = 0; x