Write your question here.
Hi, I need to present a number as string, but only with recursion.
I made it, but the the problem is that it's reversed.
What should i do?
-char s[] is wrong here because you can't increase the length of an array (except if you know the maximum size of the string which will be a correct but not very good solution to the problem).
You can use a double pointer like char **s but it will be too complicated and it'll take longer time because you'll have to do dynamic allocation on each recursion!
The best method is to use the string object in <string> header file.
- The second error which is the main problem is in the else statement: you should invert lines 8 and 9 to obtain it in correct order like abhishekm71 said before