Learning C++, day three: Integer overflow
I was happily playing with my shiny new prime-number-checker, trying out how loops work in C++. When I started entering stupidly big numbers, something strange happened. ./main Enter a number: 5784320578432578493207508493 Congratulations, it's prime! Except, that is not actually a prime number. I can’t have typed a prime number by randomly banging on the keypad. What’s going on? I didn’t code any input sanitization in my prime-number-checker, so let’s check what my program actually gets....