Checking for equality in C and C++

identifier == identifier;
The == sign is used to compare primitive types such as char, int, float, etc. The comparison operator returns true if the two identifiers are equal. == is not a good choice for comparing C-style strings or arrays because it will check whether they occupy the same memory location, not whether they share the same value.


Learn more about if statements and comparison operators