Write a function that takes a string as input and returns the string reversed.
Example:
Given s = "hello", return "olleh".
反转字符串
思路:对折交换即可完成
代码如下:
char* reverseString(char* s)
{
int i;
char t;
for(i=0;i<strlen(s)/2;i++)
{
t = s[i];
s[i] = s[strlen(s)-1-i];
s[strlen(s)-1-i] = t;
}
return s;
}