Run Time Error! Why?


  • 0
    B

    '''
    char* reverseString(char* s) {
    int len=0;
    int i =0 ;
    char *pstr=NULL;
    len=strlen(s);
    pstr=malloc(len);
    for(i=len-1;i>=0;i--)
    {
    (pstr+len-i-1)=(s+i);
    }

      *(pstr+len+1)='\0';
      strcpy(s,pstr);
      free(pstr);
      return s ;
    

    }
    '''


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.