With capacity five, advancing the write index from four wraps it to zero using modulo five.
Read the related guide · · Bookmark this unique URL with Ctrl/Cmd+D.
A circular buffer reuses a fixed array by wrapping its read and write positions to the beginning. Experiment with a small example and see each step update.
With capacity five, advancing the write index from four wraps it to zero using modulo five.
Read the related guide · · Bookmark this unique URL with Ctrl/Cmd+D.