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 digital song is broken into small pieces known as ____________.
a. tones b. samples c. pulses d. waves
If you enter a command and want to terminate its execution before it is finished, what key press should you use?
A. Ctrl+C B. Ctrl+V C. Ctrl+B D. Ctrl+X
Along with a profile image, which of the following would also be included in a user profile?
A. Sockpuppet B. Anonymity C. Tagline D. Tweet
A(n) ____ is an electronic file that contains an organized collection of related information.
A. field B. computer database C. dataset D. exception