The following header shows a way to make a generic dynamic array in C with an array of two pointers:
- the first pointer stores the length of the dynamic array;
- the second pointer points to the data.
So, int *vec[2] = { 0 }; is an empty dynamic array of ints. struct person *people[2] = { 0 }; is an empty dynamic array of people.
(uintptr_t)vec[0] is the length of the array, vec[1] is the array.