I know that when working with strings, from the definition the >> operator means
Extract string from stream
and we normally use it to store it on a variable doing something like this:
std::cin >> name;
With numbers it is a Bitwise right shift operator, still it seems a bit comfusing to me, why does it have 2 meanings?
I've seen examples like this:
crc = crc16xmodem_table[((crc >> 12) ^ (*data >> 4)) & 0x0F] ^ (crc << 4);
looking at that we see crc >> 12
, data >> 4
.
How does this really work differently with numbers and strings? Does it have something to do how strings and ints are implemented?