Pointers hold the address of the variable. So for reversing the string we need to find the ending address of the string. After finding the last address of the string we need to copy the value it holds to the reverse string rev. In order to do so we increment and decrement the pointer rptr and sptr respectively. After this step we need to again copy the rev to our original string s.