cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
What is the difference between 100 and 0
What is the difference between 100 and 0100 in binary?
Apr 30, 2018 at 2:22pm UTC
BeginnerP
(8)
I convert 4=100 in binary but converter converts 4=0100. In shifting, 4>>2=1. So, coverter is right, 4=0100. Because 100>>2=000 but 0100>>2=0001. Where am I doing wrong? Why 4 don't equal to 100?
Apr 30, 2018 at 2:32pm UTC
Peter87
(11226)
100>>2=000
If you shift the bit pattern 100 two steps to the right you end up with 001.
Apr 30, 2018 at 3:36pm UTC
BeginnerP
(8)
Thanks a lot!
Apr 30, 2018 at 3:39pm UTC
MikeyBoy
(5631)
Just to be explicit, there is no difference between 100 and 0100 in binary.
Just like there's no difference between 100 and 0100 in decimal.
Topic archived. No new replies allowed.