用C语言实现一个revert函数,它的功能是将输入的字符串在原串上倒序后返回

char* Revert(char *source) { int length = strlen(source); int start = 0; int end = length - 1; while(start < end) { char temp ; temp = *(source + start); *(source + start) = *(source + end); *(source + end) = temp; start++; end --; } return source; } int _tmain(int argc, _TCHAR* argv[]) { char * source = "Hello,world"; char *result = Revert(source); }

你可能感兴趣的:(c,语言)