One effective way to work with arrays is to place the array and its size into a struct. This allows you to keep the data and the number of elements that is has nicely together. You can then also use the size to give you the capability of adjusting the number of elements you are using, by changing the value of the array’s size. With this, you can then grow and shrink the size of the array, up to a set maximum number of elements.
The following illustrates the code and how to think about a struct that contains an array: