Forum Discussion
Altera_Forum
Honored Contributor
14 years agoIt is generally safer to use arithmetic to get the byte values from an integer.
So something like:void print_val(unsigned int val)
{
unsigned char c;
c = val;
c = val >>= 8;
c = val >>= 8;
c = val >> 8;
printf("%c%c%c%c", c, c, c, c);
}