So I was just trying to fill a buffer with consecutive numbers 0-255. I didn't think much on it and ended up in an infinite loop.
uint8_t i;
uint8_t txbuf[256];
for (i=0; i<256; i++) {
txbuf[i] = i;
}
the problem being that i
will never be 256 as it rolls over to zero after 255.
my question is, is there a way to do this loop without bumping i
up to a 16 bit value?
Note: I know I could change the loop to i<255
and add another line for the final spot but I'm trying to figure out of there is a nicer looking way.