I understand bit(n) returns the value of the bit at position n but don't understand what variable it is looking at for extracting the bit????
It does not look at a variable, rather it stands alone and always returns fixed values for a given value of n
From the reference page
Computes the value of the specified bit (bit 0 is 1, bit 1 is 2, bit 2 is 4, etc.
Delta_G:
All it is doing is raising the n to the power of two.
two to the power of n?
Suppose you needed to know if int variable "num" was positive or negative:
bool sign = num & 32768;
or
bool sign = num & 1 << 15;
or,
bool sign = num & bit(15);
If "sign" is true (1) num is a negative number.