This data structure is also known as a ring buffer, circular queue, etc.
I couldn’t find source code for a version of this data structure that takes variable length elements so I wrote this one.
I wrote this code for Visual C++ and Windows but you can easily modify it for other compilers and environments.
This page was first published on June 1, 2021 and last revised on June 1, 2021.