Implement memcpy / Reverse a String In-Place
Problem
Implement memcpy that also handles overlapping source and destination regions correctly (i.e. memmove semantics), and reverse a C string in place.
Input / Output
- Input: destination pointer, source pointer, byte count n; and a null-terminated string.
- Output: n bytes copied correctly even under overlap; the string reversed in place.
Constraints
- Handle overlapping ranges and the null terminator; no extra buffer.
Example
- memmove within an overlapping buffer; reverse("hello") → "olleh".
added …