来个双指针
字符串反转
http://www.nowcoder.com/questionTerminal/e45e078701ab4e4cb49393ae30f1bb04
C语言使用双指针的做法
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { char str[1000] = {'\0'}; char temp_str = '\0'; int low = 0,high = 0; int size = 0; scanf("%s",str); //计算字符串的长度 size = strlen(str); high = size - 1; //使用双指针的方式 while(low < high){ temp_str = str[low]; str[low++] = str[high]; str[high--] = temp_str; } printf("%s",str); return 0; }