33,008
社区成员
发帖
与我相关
我的任务
分享
#include <stdio.h>
#include <conio.h>
void reverse(char* str);
int main()
{
char *str1 = "abc";
reverse(str1);
getch();
return 0;
}
void reverse(char* str)
{
if( *str == '\0' )
return;
reverse(str + 1);
printf("%c", *str);
}
void reverse(char* str){
if(*str)return;
reverse(str + 1);
putc(*str, stdout);
}
static char* forrev = NULL;
void reverse(char* str){
if(!*str)return;
reverse(str + 1);
if(str > forrev){ // 交换
*str ^= *forrev ^= *str ^= *forrev;
forrev++;
}
}
void main(void){
char str[] = "abcdefghijklmnopqrstuvwxyz";
forrev = str;
reverse(str);
printf("\n%s\n", str);
}