On this entry we will continue the discussion about the operator, which we have discussed previously on Arithmetic Operators, Increment and decrement operators, and Operator Relations (Comparative).
At this post, we will discuss and Logical Operators Bitwise Operators.
1. Logical operators
Logical operators are used to connect two or more expressions into a conditional expression.
<> Sample Program Logical operators
<> Output Program Logical operators
2. Bitwise operators
Bitwise operators are used to manipulate data in the form of bit.
>> Bitwise operator << (Shift Left)
Bitwise Left Shift Operator << is used to shift a bit to the left
Example: 0001 0101 = 21 if the shift left 1 bit 0010 1 010 = 42
<> Sample Program Operator Bitwise << (Shift Left)
<> Output Program Operator Bitwise << (Shift Left)
>> Operators Bitwise >> (Shift Right)
Bitwise Shift Right operator >> is used to shift a bit to the right
Example: 0001 0010 = 18 if it is shifted to the right 2 bits 0000 0100 = 4
<> Sample Program Operator Bitwise >> (Shift Right)
<> Output Program Operator Bitwise >> (Shift Right)
>> Bitwise operators & (AND)
Bitwise operators & (AND) is used to compare the bits of two operands. Will be true (1) if all the operands are combined is true (1).
<> Sample Program Operator Bitwise & (AND)
<> Output Program Operator Bitwise & (AND)
>> Bitwise Operators | (OR)
Bitwise Operators | (OR) was used to compare the bits of two operands. Bernilain be true if either operand is combined there is a value true (1).
<> Sample Program Operator Bitwise | (OR)
<> Output Program Operator Bitwise | (OR)
>> Bitwise operators ^ (XOR)
Bitwise operators ^ (XOR) is used to compare the bits of two operands. Bernilain be true (1) if there is one two-bit operand is compared to only a true value (1).
<> Sample Program Operator Bitwise ^ (XOR)
<> Output Program Operator Bitwise ^ (XOR)
So, only that material Operator Discussion About On Programming Language C / C + +. Good luck to try.
Tidak ada komentar:
Posting Komentar