Question: Let f be the following C++ function: void f (char *p) { char *q = p; while (*q) q++; while (p < q) { char
void f (char *p)
{
char *q = p;
while (*q)
q++;
while (p < q) {
char ch = *p;
*p++ = *--q
*q = ch;
}
}
Assume that the argument to f is C-style (null-terminated)string.
A) What modification does f perform to the string that ispassed to it?
B) Explain how f works.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
