- 2

Increment

i ++ i =i+1 ++ i ???

8th Nov 2017, 7:21 AM
Shyamal Bhatt
Shyamal Bhatt - avatar
3 Respuestas
+ 18
#include <iostream> int main() { int i = 1; i++; // i = 2 i = i + 1; // i = 3 ++i; // i = 4 std::cout << i; // Output: 4 } [http://cpp.sh/4ssy5]
8th Nov 2017, 7:47 AM
Babak
Babak - avatar
+ 2
Yes, these operators make the same- when are used individually. Add 1 into i But try such this a=++i; // adding 1 before assign i into a //versus a=i++; // adding 1 after assign i into a You will see the different in a.
8th Nov 2017, 7:55 AM
Petr Hatina
Petr Hatina - avatar
+ 1
@Babak Sheykhan Petr Hatina thank you very 😁😁😁👍👍👍👍
8th Nov 2017, 9:40 AM
Shyamal Bhatt
Shyamal Bhatt - avatar