0

When and why should we use x++ In stead of x=x+1?

29th Jul 2016, 11:22 AM
shrijit
8 Answers
+ 6
x++ ++x x = x + 1 x += 1 All mean the same thing, and there are really no drawbacks to any of them. When incrementing by 1, the most common method would be to just do x++. It is important to consider them in loops, such as a for loop, however. x++ in a for loop will increment AFTER the body has executed.
29th Jul 2016, 4:23 PM
Cohen Creber
Cohen Creber - avatar
0
They both mean the same thing.
29th Jul 2016, 11:38 AM
Vlad Cranga
Vlad Cranga - avatar
0
no they are diffrent in executing
29th Jul 2016, 2:28 PM
Abbass Awad
Abbass Awad - avatar
0
when you want. no they are diffrent.
29th Jul 2016, 3:52 PM
Carlos Carvalho
Carlos Carvalho - avatar
0
prefix and postfix increment, for good discussion, you have to see in YouTube.. so, search in durgasoft YouTube videos..
30th Jul 2016, 6:01 AM
meherDev
meherDev - avatar
0
they are the same
3rd Aug 2016, 10:46 AM
Shreyas
0
they are answer is always same
5th Aug 2016, 7:49 AM
Zeeshan Saeed
Zeeshan Saeed - avatar
- 3
they are different
3rd Aug 2016, 10:30 AM
KAUSHIK KUMAR
KAUSHIK KUMAR - avatar