this is the correct way to convert int value to uint8_t :
int x = 3; uint8_t y = (uint8_t) x;
suppose x will never be less than 0. Although gcc does not give any warnings for the above lines, I just wanted to be sure whether to do it right or is there a better way to convert int to uint8_t?
PS I use C on Linux if you are going to offer a standard feature
source share