This code will traverse the array more than once. I do not think the solution is impossible. I was thinking the use of recursion and let the compiler use stack internally. This will also keep the solution in memory. Can any one try this approach?
No offense, but whether or not you think it is impossible doesn't change the reality that it is "Impossible unless you know a priori the length of the string to reverse." Using recursion/stacks/whatever doesn't change the problem -- it only rearranges it. No amount of rearranging will enable you to escape first traversing the string to find its length and second reversing it. The reason is simple: reversing the string is predicated on knowing its length.
There is one solution that can do this while traversing the array only once, but it only works with arrays shorter than a limit and is very wasteful memory-wise:
1. Allocate a sufficiently large string. Keep a pointer to the beginning for deallocation.
2. Set a pointer to the tail and zero the element. This is the terminator.
3. For every character in the input string, decrement the pointer and copy the character to the dereferenced pointer.
4. Return the head pointer and the string pointer.