Difference between == and === in C++
Hello everyone! Please tell me, what is the difference between the == and === operators in C++? I'm just starting to learn the language, and in some tutorials I've seen mention of triple equals, but there's no clear explanation anywhere.
I tried the following code:
#include <iostream>\n\nint main() {\n int a = 5;\n int b = 5;\n \n if (a == b) {\n std::cout << "a == b" << std::endl;\n }\n \n // Tried to use ===\n // if (a === b) { ... } // This doesn't compile\n \n return 0;\n}When trying to use ===, the compiler gives an error: 'expected expression' or 'token is not a valid binary operator' depending on the compiler version.
I expect that === is not a valid operator in C++. I've seen it in JavaScript, but in C++ there is no such operator. The == operator checks for equality of values, and === simply does not exist in C++.