You can use [ code ] tags to wrap around your code - '#' icon in rich edit mode.
The reason your code goes into an infinite loop is that the for loop exit condition is that i > 255 (since if i <= 255 , the loop continues).

If you take an integer type variable (char, int, long, unsigned char...) which contains its maximum value and add 1 to it - it will go back to its minimum value.

255 is the maximum possible value for unsigned char, so adding 1 to i when its value is 255, sets i to be 0, and hence your loop continues.

Regards,
Zachm