Two types of unary operators:-
1-pre operator (++i)(--i)
2-post operator(i++)(i--)
pre means change than use(first you change the value then use it)
post means use than change(first you use the value then change it which reflects in next usage)
Examples:-
output: 11
output:9
output:9
output:9
in this first it transfer the value of X to Y then it change which reflect in other usage.......
in this first it change the value of X then it transfer into the Y..
take a look of all the examples.......
1-pre operator (++i)(--i)
2-post operator(i++)(i--)
pre means change than use(first you change the value then use it)
post means use than change(first you use the value then change it which reflects in next usage)
Examples:-
output: 11
output:9
output:9
output:9
in this first it transfer the value of X to Y then it change which reflect in other usage.......
in this first it change the value of X then it transfer into the Y..
take a look of all the examples.......
No comments :
Post a Comment