New Generic pointer that can point to any data type
1st Parameter
Pointer to the destination memory block where the content is to be moved.
2nd Parameter Type : const void *
A pointer to a constant memory location of unspecified type. The pointed-to data cannot be modified through this pointer.
2nd Parameter
Pointer to the source memory block from which the content will be moved.
3rd Parameter Type : size_t
Platform-specific unsigned type for array indices and memory sizes.
3rd Parameter
The number of bytes to move from the source to the destination.
Read more about parameters of memmove in parameters section
The memmovefunction in C language Copies one block of memory to another, safely handling overlapping memory areas.
The memmove function copies n bytes from the object pointed to by src to the object pointed to by dest. The copying takes place as if an intermediate buffer were used, allowing the destination and source to overlap. This function is safer than memcpy when dealing with overlapping memory regions.
The memmovefunction takes 3
parameters:
•
void * `destination`: Pointer to the destination memory block where the content is to be moved.
•
const void * `source`: Pointer to the source memory block from which the content will be moved.
•
size_t `num`: The number of bytes to move from the source to the destination.
Copies `num` bytes from the memory block pointed to by `source` to the memory block pointed to by `destination`. Unlike `memcpy`, `memmove` allows the source and destination memory regions to overlap. Returns a pointer to the `destination` memory block.
The memmove function return value :
Returns a pointer to dest
Output
This example demonstrates basic usage of memmove to shift part of a string within itself.