Content deleted Content added
HughesMann (talk | contribs) m improved style in the code example, changed a useless comment and corrected a constant definition. The entire section and the code example remains incorrect and misleading and I shall fix it fully if I find the time |
→Circular buffer mechanics: Fixes in the C code |
||
Line 70:
#define BUFLEN 3
int buf[BUFLEN]; /* array to be treated as circular buffer of BUFLEN integers */
int end = 0; /* write index */
int start = 0; /* read index */
Line 77:
{
buf[end++] = item;
end %=
}
Line 83:
{
int item = buf[start++];
start %=
return item;
}
|