Interview Questions

227. Define a macro for logical XOR operation

Microsoft Interview Questions and Answers


(Continued from previous question...)

227. Define a macro for logical XOR operation

Question:
Define a macro for logical XOR operation


maybe an answer:


#define XOR(a,b) (((a)&(~(b)))|((~(a))&b))


maybe an answer:


a XOR b = ( a | b ) & ( !a | !b )


maybe an answer:


a XOR b = (a &!b) | (!a & b)

(Continued on next question...)

Other Interview Questions