C/C++ stipulates that any type of pointer can be converted into a void pointer, and a void pointer can be converted into a pointer of any type, so we can convert type into void , and then convert Convert void to char for memcpy. If the input parameter is defined as char, for types that cannot be converted invisibly by the compiler, the pointer type must be forced to char at the place of call.
What memcpy does is bit-wise copying, so it needs to be copied bit by bit. The char type only occupies one byte of space, so char is chosen for implementation. The parameter list uses void* to express that the parameter can be a pointer to any type.
C/C++ stipulates that any type of pointer can be converted into a void pointer, and a void pointer can be converted into a pointer of any type, so we can convert type into void , and then convert Convert void to char for memcpy. If the input parameter is defined as char, for types that cannot be converted invisibly by the compiler, the pointer type must be forced to char at the place of call.
What memcpy does is bit-wise copying, so it needs to be copied bit by bit. The char type only occupies one byte of space, so char is chosen for implementation. The parameter list uses void* to express that the parameter can be a pointer to any type.