|
<< is bitwise left shift
operator.
The result of the _expression_ a << b
is a value that the value a is shifted right by b
positions (bits).
(b number of bits removed from the left and b
number of 0 bits added from right)
the value b should be less than
the number of total bits of a
>> is bitwise right shift
operator.
The result of the _expression_ a >> b
is a value that the value a is shifted left by
b positions (bits).
(b number of bits removed from the right and b
number of 0 bits added from left (if a is unsigned or if a is a signed
value greater than 0)
the value b should be less than
the number of total bits of a suppose that the integer 5 is represented as
follows
0000 0000 0000 0101
5 >> 1 will be the value
0000 0000 0000 0010 (2)
5 >> 2 will be the value
0000 0000 0000 0001 (1)
5 << 1 will be the value
0000 0000 0000 1010
(10) 5 << 2 will be the value
0000 0000 0001 0100 (20)
in your main function, you call the function printf
to write the value of integer expressions to stdout in decimal system,
I mean the expresions x, x << 2 and x
>> 2.
nerg
|
- Re: (PT) Digest Number tj
- Re: (PT) Digest Number vidya sakhare
- Re: (PT) Digest Number deepankar narang
- RE: (PT) Digest Number Rohit PANDEY
- Re: (PT) Digest Number Gaurav Mishra
- RE: (PT) Digest Number Paul Herring
