Google News
logo
CPP - Quiz(MCQ)
Which operator works only with integer variables?
A)
increment
B)
decrement
C)
both increment & decrement
D)
binary operator

Correct Answer :   both increment & decrement


Explanation : Because increment and decrement operator increases increasing and decreasing values of values and no such things define in strings so cannot be used with strings. Also they cannot be used with floats and doubles because there is no way to fix how much the value should be increased or decreased if increment or decrement operator is applied on such variables. That’s why both these operators only works with integer values.

Advertisement