I was asked to create this function:
int * createAndInput(int & size)
The function initializes an array in the size of
the value size, gets the values from the user as input, and returns the allocated array and the size by ref.
Here is the code I have so far:
int *creatAndInput(int& size)
{
int arr1[***size***];
for (int i = 0; i << size; i++)
{
cout << "enter index " << (i + 1) << endl;
cin >> arr1[i];
}
return (arr1);
}
void main()
{
cout << "enter size number" << endl;
int size2 = 10;
int *size1 = &size2;
cout << *creatAndInput(size2);
}
