+ 1
What's the difference between the 2 codes?
I am getting different outputs. https://code.sololearn.com/c8XC2Z461UJu/?ref=app https://code.sololearn.com/cmxCCT4z52mN/?ref=app
5 Respostas
+ 7
It's how we do it in maths when we assign variables
also, my English isn't very good so I didn't know what else to say
+ 6
For the 2nd one, I let int a = 0 and the output was the same
though I dont know what the difference is... I have zero experience in CPP
+ 4
Quite simply, one code is incrementing the variable a before printing, while the other is incrementing after printing.
If you increment before you print, the variable will be larger than if you incremented after. This is because the variable was incremented.
+ 1
thanks
0
why let.