unsigned int (c++) vs uint (c#)
Following is the c# code: static void Main(string[] args) { uint y = 12; int x = -2; if (x > y) Console.WriteLine("x is greater"); else Console.WriteLine("y is greater"); } and this is c++ code: int _tmain(int argc, _TCHAR* argv[]) { unsigned int y = 12; int x = -2; if(x>y) printf("x is greater"); else printf("y is greater"); return 0; } Both are giving different result. Am I missing something basic? Any idea? C++ and C# are different languages. They have different rules for handling type promotion in the event of comparisons. In C++ and C, they're usually compared as if they were both