I am trying to reverse a string character by character. Here is what I have:
The problem is the function only work on the last word because the space character is not copied to wordreverse. Can anyone help me fix it?Code:void reverseString( const char *str, char *wordreverse) { int i, j; for( i = 0, j = strlen(str) - 1; i < j; i++, j--) { wordreverse[i] = str[j]; } }
Thanks