Difference Between i++ and ++i

No comments




i++ V/S ++i :


i++
++i
 1 . Post fix operator.
1 . Prefix operator.
 2 . It assigns value to the variable on left and increments the operand.
2 . It first adds one(1) to the operand and then the result is assigned to the variable on left.
3 .  i = 5;
      y = i++;
The value of y would be 5 and I would be 6.
3 .  i = 5;
      y = ++i;
The value of and I would be 6.

No comments :

Post a Comment

Subscribe

Milan Panda
Admin
About Me | Contact
Copyright 2023-2024 © Programming1011 . 🎀 Developed and Design By- Milan Panda. Happy Holi All Of You 🎀