+ 5
Adding in C++
What's the difference between a = a+1 and a += 1? I noticed when I tried using a+2 in a loop, it responded with a timeout error.
3 Respuestas
+ 6
a = a +1 is the same as a += 1 and still the same as a++
however if you use a+2 you bound to get a timeout error since value of "a" is never changed in that expression
so use a = a+1, a+=1 or just simply a++
hope this help you
+ 3
Ok, so that makes sense
So I'd have to do a = a+2. which could be shortened with a+=2. Thanks Mind To Machine 💻🕆
+ 2
anytime Daniel Cooper 😊😎😉