circular buffer using c