Very simple ring back and forward

   We all know this stuff circular queue, a pointer to a pointer, two pointers can be achieved through a two-way circular queue. It's easy. But today let's use an array of ways to achieve circular queue of forward and back, how to engage in?

   Silly than the original one, a [32]   

int i = 0

Before forge a [(i ++)% 32]

Back began to screenwriters, for fear i -, i 0 how small and do. a [(i + 32 -1)% 32] This is not on the list thing, plus a periodic function cycle, be it. It had been too Niubi, first the universe. I hope everyone together to share some of their own little ideas.

Guess you like

Origin blog.csdn.net/qq_16810885/article/details/92692029