I'm looking for a C function similar to the C# Array.Copy(). I found memcpy() only, but I need to copy from specific index too.
If you have an array like this:
SomeType myArray[50];
And you want to copy elements indexed 19-29 (the 20th through 30th elements).
Then you do:
memcpy(dest, &myArray[19], 10 * sizeof(SomeType));
Note: this code-segment makes no provision for initializing myArray
, or allocating memory to dest
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With