When we are passing a string to the strrev function, which is provided by Microsoft, and has the function prototype in string.h. It reverses the string we are passing to it and returns the same address back.
First thing – should it modify the original char array?
Second thing – When it is modifying the same pointer we are passing to it,why should it send it back?!
First, yes, it should modify the original array. That’s its sole purpose.
Second, yes, it should return the pointer to the array. There’s nothing else useful for it to return, and sometimes getting the pointer back makes the code more compact, saving the need for a temporary if the parameter passed to
strrevisn’t already stored in a variable.