Can we pass array with call by value in function

I want to pass an array in my function, And my function will be changing the elements of the array in the fuction, but it should not affect the values in my array variable of main function

One way:

int foo(int *arr, int elem)
{
    int *local_arr=malloc(sizeof(int) * elem);
    memcpy(local_arr, arr, (size_t) elem * sizeof(int) );
    /* use local_arr here */
    free(local_arr);
    return 1;
}