0

Following, my code is available

int size(char *);
void reverse(int, int, char*);
int main()
{

    char *str="Hello World";//This sentence reverses using function reverse
    int len = size(str);

    reverse(0,len,str);
    cout<<str;
return 0;
}


int size(char *arr){
    int rslt=0;
    while(arr[rslt]!='\0'){
        rslt++;
    }
    return rslt;
}

void reverse(int strt, int end, char *arr){
    char tmp = 0;

    for(;strt<end; strt++){
        tmp = arr[strt];
        arr[strt] = arr[end-1];  //<------------------Marked
        arr[end-1] = tmp;
        end--;
    }
}

When it comes to marked point, It stopped the program, Thank you for the helps.

enter image description here

0 Answers0