Why do I not get the correct answer if I do like this:
long long number = 5500000000000000; // 16 digit number - 53bit
long long temp_number = 0;
temp_number = number >> 50;
printf("%d", temp_number);
Answer will be: 4
That is not correct, I want it to show 5.
Kind regards
The bit pattern of that number is:
When shifting right 50 places, you are essentially discarding the 50 least significant bits, so you are left with:
Which,coincidentally, is 4.