You are working with a pre-filled circular buffer of 10 elements.
The buffer is structured as:
typedef struct {
int buffer[10];
int head; // Write pointer
int tail; // Read pointer
int count; // Number of unread bytes
int capacity; // Always 10
} CircularBuffer;
Your Task
Implement this function:
void read_bytes(CircularBuffer *cb, int n);
This function should:
Read and print n values from the buffer
If there are fewer than n values, print "NULL" in place of missing ones
Advance the tail properly with wrap-around
Decrease count after each successful read
After reading, print the new value of the tail index on a new line