Explain why the assignments below are illegal see main cause
Explain why the assignments below are illegal (see main causes of mistakes in section 3.19). s1 (0)
Solution
Relational operator(<=) are used to compare two integer type of operands, Contional operator are used to perform operations on boolean expressions
a.)s1(0) / s2(0) is not a integer. Therefore the assignment will give illegal operator error while compilling. Correct will be s1<=s2, where s1, s2 is a integer
b.)s2 is not a integer, and OR is illegal token, correct will be s3<=s1; where s1, s3 is a integer.
c.) When we compare using relational operator the output is a boolean value. Also here we are comparing values which is wrong. Also we cannot use \"comma\" between expressions. Only integer variable can be used.
d.)Is correct
