Skip to main content

Posts

Showing posts with the label Bitwise Operators in C

Bitwise Operators in C

Bit level operators make C useful for many low level applications. Bitwise operations allow one to read and manipulate bits in variables of certain types. The bit wise operators only work on int and char types. The following are the bitwise operators in C Operator Description ~ Bitwise Complement <<   Bitwise Shift Left >>   Bitwise Shift Right & Bitwise AND ^ Bitwise EX-OR | Bitwise OR Bitwise operations helps to work on Boolean variable, which needs only one bit.Set membership can be represented with Boolean variables ( 1 means element in the set 0 means not in the set) and the Bitwise-AND can be used to implement set-intersection and Bitwise-OR to implement set union. The bitwise AND(&) is true only if both bits are set. The bitwise OR(|) is false only when both the bits are false. The bitwise EX-OR operation returns 1 if the input bits are different. Th