What the function outputs is not the matter at hand.
I will not use double pointers, so go ahead and show me how to use references to pass arrays.
The function call will be in main. Give me the code.
P.s.:
The Objects that the dynamic array points to, and the Function in question, are of the same type.(I.e.: Abstraction - Putting Functions and data members together within the same class)
Go ahead and show me how to use references to pass arrays.
Fundamentally, it doesn't make sense to pass references or pointers to an array of dynamic size, since such array types are impossible to specify. Given an array of fixed size: int a[3];, a reference to an array of 3 int named b can be written int(&b)[3]; a pointer to the same can be written int(*c)[3].
Given a pointer to the first element of some dynamic storage: int* a = newint[foo];
You can pass it to a function along with its size.
1 2 3 4 5 6 7 8
void bar(int* a, int sz) noexcept { ... };
int main() {
int foo = 23;
int* const a = newint[foo];
bar(a, foo);
delete[] a;
}