*Author : DavidLin
*Date : 2014-12-15pm
*Email : linpeng1577@163.com or linpeng1577@gmail.com
*world : the city of SZ, in China
*Ver : 000.000.001
*For : reverse the char array/string!
*history : editor time do
* 1)LinPeng 2014-12-15 created this file!
* 2)
*/
char * reverse(char * buf)
{
int len;
char tmp;
int i;
if(NULL == buf) {
return NULL;
}
len = strlen(buf);
for(i = 0; i < len/2; i++)
{
tmp = buf[i];
buf[i] = buf[len -i -1];
buf[len -i -1] = tmp;
}
return buf;
}
有个函数:char* reverse(char *buf)
最新推荐文章于 2024-04-04 20:10:47 发布