1.

Pick out the compound assignment statement.(a) a = a – 5(b) a = a / b(c) a -= 5(d) a = a + 5This question was posed to me in final exam.This question is from Essential Operators in section Source Files, Classes and Operator Overloading in C++ of C++

Answer»

The correct answer is (c) a -= 5

To explain: When we want to modify the value of a variable by performing an operation on the value CURRENTLY stored,We will USE compound assignment statement. In this option, a -=5 is EQUAL to a = a-5.



Discussion

No Comment Found

Related InterviewSolutions