I Wrote An “Impossible” Bug in a C Program. THIS is How I Fixed It.

Well, it seemed impossible at first sight. There was a test on a value that I had predefined so I knew it must be true. And yet the test failed. WHY??? To understand this problem in more depth, you need to understand how numbers and other data types are represented at a fairly low level. If this is new to you, or if you are uncertain about the finer details, I suggest you watch these videos: Bits, Bytes and Binary Numbers    • Bits, Bytes and Binary Numbers   What is a Binary Number?    • What Is A Binary Number?   Signed and Unsigned Numbers    • Signed and Unsigned Numbers Made Easy! – B...   Why Do Big Numbers Turn Negative?    • Why Do Big Numbers Turn Negative (in compu...   MORE LESSONS ============= To watch other videos about “low level programming”, go to the “Down To The Metal” playlist:    • Down To The Metal   Also, my series on “Programming C in Visual Studio”:    • Program C in Visual Studio   Be sure to subscribe to the Code With Huw channel so that you get a notification when I upload more lessons in this series. PROGRAMMING BOOKS ==================== If you want to learn programming in more depth (and also support this channel!) you might think of buying one of my books. I have written books on C programming, Using Pointers in C, Recursion and other programming topics. You can buy my books (paperback or Kindle) on Amazon. ** The Little Book Of Pointers ** Amazon (US) https://amzn.to/2LF2aVb Amazon (UK) https://amzn.to/2FViSvS ** The Little Book Of C Programming ** Amazon (US) https://amzn.to/2RXwA6a Amazon (UK) https://amzn.to/2JhlwOA “CODE WITH HUW” ON TWITTER: =================================   / codewithhuw   “CODE WITH HUW” ON FACEBOOK: =================================   / codewithhuw   Good luck! And good programming!