Removing first X elements from array
c, pointers
Solution
Since the array is global it will exist in memory until your program terminates. But this won't stop you declaring a pointer which points to one of its internal items, and using this pointer as the start of your array. With your notations: `char* p = arr + X;` This way `p[0]` will be equal to `arr[X]`, `p[1]` to `arr[X + 1]`, and so on.
Problem
I have an array named arr of size 1024. So basically I want to delete the 1st X elements of the array. How would I do that? This is what I am thinking: Make a pointer pointing to the 1st value of the array (arr[0]). Do pointer arithmetic to take it to the X'th element of the array. Then set the arr[0] to the pointer p, which will effectively remove the first X elements? Will this work? Or is there an easier way to remove the first X elements of the array?