CJCoding With Joseph
← Back to Question List
C++ Code Walkthrough #49

Comparing Signed and Unsigned Integers

hardType Conversion

📄 Code

Read carefully — what does this print?
1#include <iostream>
2using namespace std;
3 
4int main() {
5 unsigned int u = 3;
6 int i = -1;
7 if (i < u)
8 cout << "less" << endl;
9 else
10 cout << "not less" << endl;
11 cout << (i < u) << endl;
12 return 0;
13}

🎯 Your Answer