0

++var and var++ always equal the same thing so why have ++var? It should not even exist. It seems redundant to me.

variables.

1st May 2017, 7:15 PM
Kevin Matthew
Kevin Matthew - avatar
5 Antworten
+ 4
there is a significant difference and it's quite practical
1st May 2017, 7:37 PM
‎ɐısıօլɐ
‎ɐısıօլɐ - avatar
+ 2
start back from basics man , pre-increment & post. one simple a=5 ; b=a++,b=5,a=6 ; b=++a,b=6,a=6 ;comment if m wrong
1st May 2017, 7:40 PM
Ujjwal Anand
Ujjwal Anand - avatar
+ 1
There is a difference between them.. as the former one is prefix-increment and the latter one is postfix increment. So after the operation performs on var then values which come will be different. The ++var first adds the value by one and prints the result whereas var++ first prints the value which is assigned and then increments its value by one.
6th May 2017, 4:02 PM
Shikha Pawar
Shikha Pawar - avatar
1st May 2017, 7:21 PM
Keshave Jat
Keshave Jat - avatar