What will be the output of a++ when int a = -1
Answers
Answered by
23
Answer:
if int a=-1 then a++ output will be zero (0)
Answered by
19
Answer:
The answer is 0
Explanation:
Since it is a shorthand operator, the same variable is to be used both before and after the assignment sign, therefore,
a++
= -1 + 1 [it will be added afterwards as it is postfix, but since there is no variable afterwards, we'll add it right away]
=0
Similar questions