how to duplicate an int array in c code example
Example: copy array of integers in c
int * intdup(int const * src, size_t len)
{
int * p = malloc(len * sizeof(int));
memcpy(p, src, len * sizeof(int));
return p;
}
int * intdup(int const * src, size_t len)
{
int * p = malloc(len * sizeof(int));
memcpy(p, src, len * sizeof(int));
return p;
}