Text: in C language
Question 4 (33 points)
a. Write a function that takes an int as its parameter and returns another int whose binary representation is the same as the parameter's but with the bits in reverse order. Example:
int x = 0x0500A14E;
int y = bitrev(x);
x in binary is 0000 0101 0000 0000 1010 0001 0100 1110
y in binary is 0111 0010 1000 0101 0000 0000 1010 0000
y in hexadecimal is 0x728500A0
b. In a 32-bit int, the least significant bit is called bit zero and the most significant bit (usually the sign bit) is called bit 31. Write a function called extractIntN, int A, int B which returns the int value stored in bits A to B (inclusive) of N. Example, using the value of x from above:
y = extractIntN(x, 7, 14);
z = extractIntN(x, 16, 18);
y is 66, or in binary 0100 0010
z is 5, or in binary 101