I'm not sure what '& 0x10' is doing. Could someone kindly explain it or advise
me on topics to research and teach myself. Thank you.
if(ptr1->name & 0x10)
Is taking whatever the value of ptr1->name
is and bitwise-ANDing it with 0x10
.
If you understand hex, then you know that 0x10
is 16 in decimal, and presumably you know that 16 is 2^4 which means in binary this value is 0b10000
.
If the result of this operation is non-zero, then this tells us that the 4th bit of ptr1->name
is set (bit numbering starts at 0, e.g 2^0 = 0x1), and will result in the execution of the line prt2->indicator1 |= 0x80;
Check out bitwise operators in C