It has to do with the way the call reverse(no--) is being implemented. The post decrement operator allows for the variable to be used in it's contextbefore it is decremented. So, in your situation it is using the original value of no for the recursive call and decrementing itafter that (which never occurs). Change that to reverse(--no) or reverse(no - 1) and you will get the behavior you are after.
L7Sqr
Practically a Master Poster
657 posts since Feb 2011
Reputation Points: 201
Solved Threads: 124