char * revert(char * source)
{
int len = strlen(source);
int start = 0;
int end = len - 1;
char temp = '\0';
while(start < end)
{
temp=*(source + start);
*(source + start)=*(source+end);
*(source + end)=temp;
start++;
end--;
}
return source;
}
int main(void)
{
char source[] = "Hello";
puts("source:");
puts(source);
char * result = revert(source);
puts("revert:");
puts(result);
return 0;
}
阅读(1618) | 评论(0) | 转发(0) |