This results in 60000.
When i replace x or y with a number (unsigned long xy = x * 1000;), it results in 60000 too.
Buy when i replace both variables it results in 4294961760.
kduin:
60 * 1000 is out of this range, so the int "overflows".
Not really.
60,000 can be stored within an int, so it stores it as 0xEA60. The problem is it's assumed to be signed, therefore 0xEA60 is recognized as -5536. You then tell it to store it in an unsigned long, so it has to expand the sign bit through the remaining data to remain consistent with the two's complement system, turning it into 0xFFFFEA60. If you convert that to decimal, you get the value that you see.