A function to handle multiple datatypes

Your question about memcpy appears to be addressed here:

In particular check answer 6 (at present)

The memcpy function takes void* arguments, meaning that no assumptions are made about what is being pointed to; no aliasing has occurred here. In contrast, (unsigned)&p interprets a pointer to void* as a pointer to unsigned, which is aliasing.

If I understand correctly (and I'm not sure I do) the anti-aliasing rule is supposed to stop you casting a type to void and then to another type, in some sort of "trickiness" that may or may not work in a particular implementation and endianness.

(edit) In particular, it might confuse compiler optimization.

However a function like memcpy, or malloc, isn't trying to cast (say) char to int, it's trying to return (or copy) a block of memory of any type.

Disclaimer: I might be wrong about this.