void re(char *str, int len);
void re2(char *str);
int main()
{
char str[1024] = “I am from ShangHai”;
//char str[1024] = “a b c d e f”;
re(str, strlen(str));
printf("first : |%s|\n", str);
re2(str);
printf("second : |%s|\n", str);
return 0;
}
void re(char *str, int len)
{
int i;
for (i = 0; i < len / 2; i++)
{
char temp = str[i];
str[i] = str[len - i - 1];
str[len -i - 1] = temp;
}
}
void re2(char *str)
{
//find word
//start index + word’s length
int index = 0;
int start = 0;
int len = 0;