Here is my code:
void reverseStr(char *str)
{
if (str == NULL) return;
int i=0, j=strlen(str) -1;
while(i<j)
{
char temp = str[j]; //i think this is the cause of the problem
str[j] = str[i];
str[i] = temp;
i++;
j--;
}
}
So here is where it is called:
int main()
{
char *str = "Forest Gump";
reverseStr(str);
cout << str;
}
Here is my error: /Applications/TextMate.app/Contents/SharedSupport/Bundles/C.tmbundle/Support/bin/bootstrap.sh: line 7: 1931 Bus error "$3".out
Any thoughts? Thanks in advance.