bitwise left shift and right shift operators ltlt


Bitwise Left Shift and Right Shift Operators: <<, >>

shift-expression :

additive-expression

shift-expression << additive-expression shift-expression >> additive-expression

The bitwise shift operators shift their first operand left (<<) or right (>>) by the number of positions the second operand specifies.

Example

In the following example, the right shift operator moves the data bits two positions to the right, thus changing the value of nNumA:

// Example of the bitwise right shift operator

int nNumA=8;   // beginning value is 8

nNumA >> 2;    // ending value is 2

 

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: bitwise left shift and right shift operators ltlt
Reference No:- TGS0305562

Expected delivery within 24 Hours