#C recursion
I started to learn C two weeks ago and as I was playing with recursion, I made
a very simple program that would point to a string and that would print it
backward. But for some unknown reason, It doesn't work. here is the program :
char str[] = "paulo"; reverse(s) /* reverse string s */ char
t[6]; char s[]; static int x; { main()
if (*s != '\0') { { reverse(++s);
reverse(str); t[x++] = *s;
printf ("%s",t); } } }
It seems that when it gets to the end of string character, it goes through the
program but never pops out the pointer to the end of the string. I did the same
program but instead of using pointers I used characters and it worked fine.
When it got to the end of string character, It would go through the program,
pop out the character and start going back through the recursion with the
previous character. Anybody has any idea why it does this. HELP !!!!