Computer Science, asked by SehajbirKang2289, 8 months ago

Difference between i++,++i,i--&--i

Answers

Answered by dawnofanera122
0

Answer:

i++ adds the value of 1 to the variable i.

++i has the same use.

similarly,both --i and i--  subtract 1 from the variable i

Answered by sudhirjadhav1905
0

Answer:

i++ : assigns the value and then increments it.

++i : increments the value and then assigns to variable.

i-- :  assigns the value and then decrements it.

--i : decrements the value and then assigns to variable.

Explanation:

Ex:

int a=5;

int b;

b=a++;

now if you print value of 'b' then it would be 5 and if you try to get value of 'a' it would be 6.

Similar questions