#include<stdio.h>
#include<string.h>
void reverseMe(char *,int,int);
int main()
{
char str[]="cycle";
int len=strlen(str);
reverseMe(str,0,len-1);
return 0;
}
void reverseMe(char *x,int begin,int end)
{
char c;
c=*(x+begin);
*(x+begin)=*(x+end);
*(x+end)=c;
reverseMe(x,++begin,--end);
}
Run Code Online (Sandbox Code Playgroud)
为什么会出现分段错误?我犯的错误是什么?