Can i compare unsigned long with int??
Just Checking
andrewk1219:
Can i compare unsigned long with int??
Just Checking
Why didn't you check with the compiler?
Of course you can! ![]()
If you have warnings turned up you WILL get a warning.
If the "int" contains a negative number it will likely compare as greater than the unsigned long. It gets sign-extended to 'long' and then treated as unsigned. The value -1 (0xFFFF) becomes 4,294,967,295 (0xFFFFFFFF).