现在的位置: 首页 > 综合 > 正文

反转字符串

2013年05月12日 ⁄ 综合 ⁄ 共 243字 ⁄ 字号 评论关闭

 

#include <locale>
#include <iostream>
using namespace std;

void rstrcpy(char *from,char *to)
{
  int i= strlen(from)-1;
  while(i>=0)
  {
  *to=from[i];
to++;
i--;
  } 
}

int main( )  
{
  char t[5]="0000";
//for(int i = 0;i<16;i++ )
  char s[5]="1234";
  rstrcpy(s,t);
  printf("%s",t);
}

抱歉!评论已关闭.