[Solved] trying to create a circular buffer in C++ using struct
supposing head is the index where you place a new value, when you push a value temp.head++;must be replaced by temp.head = (temp.head + 1) % BUFFER_LENGTH; to manage the length of the buffer. You also have to move the tail when the buffer is full. I do not understand why you push 1 value … Read more