postfix | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

postfix

int a = 15; int b = a++; //out put 15 int c =15; int d = a+=1; // Out put 16 i can't understand both are same... why they give different value

3rd Jun 2018, 8:19 PM
youk
1 Answer
+ 2
int a = 15; int b = a++; //After that a=16, b = 15 because postfix increse, increse after give it to b value int a = 15; int b = ++a; /After that a=16, b = 16 because preffix increse, increse before give it to b vaule
3rd Jun 2018, 10:42 PM
Krzysztof303
Krzysztof303 - avatar