Reputation: 3357
following program should print "error" but its printing success.why?
#include<iostream>
using namespace std;
int main()
{
unsigned int a;
a=-10;
if(a == -10)
cout << "success" ;
else
cout << "error" ;
return 0;
}
Upvotes: 3
Views: 175
Reputation: 799230
The conversion for comparison makes them equal again. But it should cause the compiler to emit a warning.
Upvotes: 6