C语言翻转字符串
#include <stdio.h> #include <string.h> void reverse(char* s) { int i; char temp; size_t l = strlen(s); for (i = 0; i < (l/2); ++i) { temp = s[i]; s[i] = s[l - i]; s[l - i] = temp; } }
C语言翻转字符串
#include <stdio.h> #include <string.h> void reverse(char* s) { int i; char temp; size_t l = strlen(s); for (i = 0; i < (l/2); ++i) { temp = s[i]; s[i] = s[l - i]; s[l - i] = temp; } }