It is important to understand the difference in C and C++ between using a
single equal sign (=) and a double equal sign (==). The single equal sign performs
an assignment of the value on the right side of the equal sign to the
variable on the left side of the equal sign. If a constant is on the left side of
the equal sign, your program will not compile, and you’ll get a nice error
message telling you that you cannot assign the value on the right to the
constant on the left. The double equal sign (==) is used for comparison. It is
important to make certain that you use the double equal sign when you
want to compare two values because if you use a single equal sign, you alter
the value of the variable on the left. This confusion is one of the biggest
sources of logic bugs in C/C++ programs.