You can copy the data into new arrays using memcpy:
int b[2], c[3];
memcpy(b, a, sizeof(b));
memcpy(c, &a[2], sizeof(c));
However, if you do not need the results to be two independent arrays, and would not mind them being pointers, you can do this:
int *b= a, *c = &a[2];
These two pointers can be used in ways similar to arrays except for two important differences:
sizeof(b) and sizeof(c) will represent the size of the pointer, not of the array
- The memory pointed to by the two pointers would not be independent of the original
a[5] array.
If you print the content of memory pointed to by these two pointers, you would get the same results as if they were arrays:
for (int i =0 ; i != 2 ; i++) {
printf("b[%d]=%d\n", i, b[i]);
}
for (int i =0 ; i != 3 ; i++) {
printf("c[%d]=%d\n", i, c[i]);
}
memcpyapproach described above is more efficient, but you don't give any impression that you even understand how to do it in a straight forward way. I'm tempted to downvote the question, but I really can't tell if you're being lazy or you really don't know anything about programming.