previous | start | next

A C function getMSByte(int x)

Use only 1 byte constants in your code.

Allowable operators: ! ~ & ^ | + << >>

int getMSByte(int x)

This function should return an integer with the most significant byte equal to the most significant byte of x and the other bytes should be 0.
Example: if x = 0x12345678, getMSByte(x) should return 0x12000000.

How would you write this function?



previous | start | next