Question.8
A firmware engineer replaces a linear UART receive buffer with a circular buffer. The old code used a linear array with a write index that reset to 0 after processing:
// Old: linear buffer
if (write_idx == BUF_SIZE) {
process_buffer(buf, write_idx);
write_idx = 0;
}What problem does the circular buffer solve that the linear buffer cannot?