用递归函数反向输出字符串
#include<stdio.h>
void reverse(const char *const sPtr);
/* 用递归函数反向输出字符串 */
int main()
{
char sentence[80];
/* 输入字符串,并存入字符数组sentence内 */
printf("Enter a line of text:\n");
gets(sentence);
/* 调用递归函数反向输出字符数组sentence内的字符 */
printf("the line printed backwack is:\n");
reverse(sentence);
getch();
}
/*递归反向输出字符串*/
void reverse(const char *const sPtr)
{
if(sPtr[0] == '\0')
return;
else{
reverse(&sPtr[1]);
putchar(sPtr[0]);
}
}
请教:此段递归程序是如何执行反向输出字符数组内的字符的?