There are several key ideas behind a circular buffer. The read pointer “chases” the write pointer around the buffer; thus, the increment functions must wrap around. Furthermore, the write pointer always references an “empty” location. Thus a buffer with N+1 locations can hold at most N data elements. Thus we define the basic data structure as follows