In an interview, I was asked to write an implementation of strcpy and then fix it so that it properly handles overlapping strings. My implementation is below and it is very naiv
if a > b; then copy a from the beginning else if a < b; then copy a from the ending else // a == b do nothing
You can refer to an implementation of memmove, it's quite like what I said.
memmove