64,647
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
#include <cstring>
using namespace std;
void reverse(char* str);
int main()
{
char* str = "character";
reverse(str);
return 0;
}
void reverse(char* str)
{
char* pbegin = str;
unsigned len = strlen(str);
char* pend = pbegin + len - 1;
while(pbegin < pend)
{
char tem = *pbegin;
*pbegin++ = *pend;
*pend-- = tem;
}
}