How do you implement a circular buffer in C?
The simplest solution would be to keep track of the item size and the number of items, and then create a buffer of the appropriate number of bytes: typedef struct circular_buffer { void *buffer; // data buffer void *buffer_end; // end of data buffer size_t capacity; // maximum number of items in the buffer size_t … Read more