Dec 6, 2012 #1 M Murugesh_89 Full Member level 5 Joined Nov 23, 2012 Messages 266 Helped 7 Reputation 12 Reaction score 6 Trophy points 1,298 Location India Activity points 3,267 Hi, Please let me know the reason.. My program is... void main() { int a,b; a = -1; b = -1u; if(a == b) do_task1; else do_task2; } The condition passes and do the task1. Why is it so even though i made b as unsigned?? Need reason for this...
Hi, Please let me know the reason.. My program is... void main() { int a,b; a = -1; b = -1u; if(a == b) do_task1; else do_task2; } The condition passes and do the task1. Why is it so even though i made b as unsigned?? Need reason for this...
Dec 6, 2012 #2 jayanth.devarayanadurga Banned Joined Dec 4, 2012 Messages 4,280 Helped 822 Reputation 1,654 Reaction score 791 Trophy points 1,393 Location Bangalore, India Activity points 0 You have declared a and b as int variables? Code: int a,b; Code: Change it to unsigned int a , b; and see if you get the right value.
You have declared a and b as int variables? Code: int a,b; Code: Change it to unsigned int a , b; and see if you get the right value.