Is shift operator a practical concept ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Is shift operator a practical concept ?

when we can use or we must use shift operator in c++?

30th Mar 2019, 6:21 PM
Saeed Moradi
Saeed Moradi - avatar
2 Answers
+ 3
The shift operator is mainly used in bit manipulation. See https://graphics.stanford.edu/~seander/bithacks.html In every day programming I doubt you'll use it much. Currently I'm working on a gameboy emulator and there you have to read individual bits all the time. You'll see <<, >>, &, |, ^'s all over the place.
30th Mar 2019, 7:03 PM
Dennis
Dennis - avatar
+ 2
It's useful in bitwise operations for graphics/imagery. We used this in a class to do image editing in Java (i.e. gaussian blur, grayscale, etc)
30th Mar 2019, 7:05 PM
naomi
naomi - avatar