I kind of understand the basic concept of adding to the end / overwriting the oldest when the buffer is full, but i am not sure about where to add new data in the buffer when there is free space at the start of the array (the left hand side) but it is already occupied by data at the end (the last few elements).
For example... i have an array called 'queue' with 10 elements: queue[0,1,2,3,4,5,6,7,8,9]
It currently has 4 items in it, which occupy elements [6][7][8][9], [6] holds the oldest item and [9] holds the newest item.
When i want to add 2 items to the queue, am i shifting the 4 existing items down 2 elements to make room at the end ? (like this--)
0 1 2 3 4 5 6 7 8 9
[ ][ ][ ][ ][*][*][*][*][ ][ ] (putting the two new items in [8] and [9] )
Or do i leave the 4 existing items where they were and put the two new items in elements [0] and [1] ?
Would be a big help if someone can help :)