Pergunta de entrevista da empresa Apple

Write code for writing to a circular buffer.