I need help understanding the code for reversing an of string : I do need help understanding a code of reversing the array of string

I have been looking through few codes, and just trying to understand it. it is function using pointer

void ReverseString(char *pStr){

int length = 0;

int i = 0;

while(pStr[i]!='\0')

    {

    length++;

    i++;

    }

 

    for (int i = 0; i < length / 2; i++) {

 

    char temp = pStr[length - i - 1] ;

    pStr[length - i - 1] = pStr[i];

    pStr[i] = temp;

    }

}

 

expecting to reverse a string, have a main function different