|
|
|
|
|
BEGINNERS TUTORIAL
Hi,
This is a small but important tutorial about increment operators used as prefix or as suffix. What is the difference ?
Base B=45 B++ //B=B+1
Result will be B=46
example B=45 A=B++
Result will be B=46 BUT A=45 !
Why ? : Because the value of B was given to variable A BEFORE the increment of variable B.
example B=45 A=++B
Result will be B=46 and A=46
Why ? : Because the value of B was given an increment BEFORE passing it to variable A.
The same for decrement operator !
Regards.
|
|
|