Part of an exercise in my book requests "Write a function called bit_test that takes two arguments: an unsigned int anda bit number n. Have the function return 1 bit number n if it is on inside the
word, and 0 if it is off."
The if statement of the function that deals with this is:
if ( (word >> (31 - n)) & 0x1 )
return 1;
I don't understand what it is saying.
The argument shifts word to the right by (31-n) which is AND'ed with the hexidecimal 1. What does that mean?