Best method to create a sub array from an array in C

arrays, c

Solution

memcpy(a2, &a[1], 2*sizeof(*a));

Problem

I have an array say `a[3]={1,2,5}` . I have to create another array `a2[2]={2,5}`. What I have tried is to just create a new array `a2[]` and just copy all the elements from the required position range. Is there any other method to accomplish this in C?.

Original source