What is the difference between the = and = = operators in C?
What will be an ideal response?
Many beginning C programmers make the mistake of using a single equal sign (=) instead of the double equal sign (= =) when attempting to test the value of a variable. A single equal sign (the assignment operator) is used to assign a value to a variable. For example, a = 5 assigns the value of 5 to the variable a. To test the value of variable a, you could use the command "if (a = = 5)". If you mistakenly wrote the statement as "if (a = 5)", the value of 5 is assigned to the variable a, and then the statement is evaluated as true. This is because any value not equal to zero is evaluated as true, and a zero value is evaluated as false.
You might also like to view...
A placeholder can also contain lorem ipsum phrases
Indicate whether the statement is true or false
You can protect a form to restrict its use to allow the user to enter data in the control fields only
Indicate whether the statement is true or false