I\'m making a program in C. I am to extract bytes. un8 extractbyte (int r, int pos) should return byte number pos from number r. As example, I use as input: <
un8 extractbyte (int r, int pos)
I would make your extractbyte function something like this.
extractbyte
int extractbyte(int n, int pos) { return (n >> (pos * 8)) & 0xff; }