Is there a way to reverse an array by ONLY passing in the array? It seems that it is pretty easy if both the array and the number of the elements in the array are passed but not just the array. For example:
The problem in those is that the function does not know that the pointer actually points to an array nor how many elements such array might have.
Edit:
Your line 17 is not supported by standard C++. The compiler should generate instructions that reserve memory from stack for the array when the function is called. However, nobody knows how much memory should be allocated. Not when compiling. Not when starting the function.
If you want the user to determine the size of the array, then you have to allocate memory for the array dynamically. The standard library has std::vector for that purpose.