What Is The Difference Between The Prefix And Postfix Forms Of The ++ Operator

What Is The Difference Between The Prefix And Postfix Forms Of The ++ Operator


  • 7 Aug, 2012

    for example,

    j=0

    i=j++     this is postfix operator

    Incase of postfix operation, current value of expression gets printed and then value gets incremented by 1. hence i=0 and j=1.

    i=++j          this is prefix operator

    previous value of j is 1 and now j gets incremented by 1. hence i=2 and j=2

    Comments Received:
    Please give your suggestions and feedback:
  • 29 Dec, 2011

    The postfix form returns the current value all of the expression and then performs the increment operation on that value.

    Comments Received:
    Please give your suggestions and feedback:

2009-2016 downloadmela.com. All rights reserved.