#include <stdio.h>
char* reverse_str(char* str)
{
if(NULL == str)
return str;
char *begin;
char *end;
begin = end = str;
while(*end != ‘\0‘){
end++;
}
--end;
char temp;
while(begin < end){
temp = *begin;
*begin = *end;
*end = temp;
begin++;
end--;
}
return str;
}
int main(){
char str[] = "abcdef123";
printf("%s",reverse_str(str));
return 0;
}
原文:http://www.cnblogs.com/fangying7/p/4716655.html