My comments:
- Looking at your instructions, you don't need DisplayArray in the first place. You're supposed to print the second half of the dynamic array from the end each time and then copy the unprinted first half to another dynamic array, which means that by the end, you have a dynamic array of just one element that was already printed on the last iteration of the loop.
- input is too generic a name; size or following your abbreviation arrSize would be more descriptive.
- Declare variables near first use; in particular, it is best to declare them at the point where you can give them a meaningful initial value. So, instead of declaring currentArr and later assigning to it, just write:
Likewise, halfSize was better declared as in your post #1 rather than your post #3.Code:int* currentArr = new int[input];- You need to update size with halfSize. I'm deliberately calling it size now because it is harder to reason about that when you call it input. Calling it size means you know it is the size of currentArr, and if you keep halving currentArr, clearly you need to keep halving size.
- There is no need to first assign nullptr to a pointer when you're immediately going to assign another pointer to it.
- Despite the reminder in your instructions, you forgot to delete[] currentArr when done with it.