
Help with code
Can someone explain me what this code does?
Code:
char CRC[8];
DoInvert = ('1'==BitString[i]) ^ CRC[7];
Especially :
Code:
('1'==BitString[i])
For me DoInvert calculates the XOR between ('1'==BitString[i]) and CRC[7]
Can someone help me with this?
Thank you

char CRC[8];
char CRC[8] declared "CRC" as a "character variable". The [8] specifies that 8 digits are to be allocated to its memory.
So for instance if your code later said "cin >> CRC" to which the user would define CRC, only the first 8 characters that were input would be used to define CRC's value.
DoInvert = ('1'==BitString[i]) ^ CRC[7];
DoInvert is exactly what it sounds like. It does the inverse of what is requested.
('1'==BitString[i]) is checking whether the variable "1" (which must have been declared as a variable earlier) is equal to BitString (also likely declared earlier)
^ CRC[7] is a mathematical function. It is the inverse of XOR. Hence why DoInvert calculates the XOR between the given values.