WHAT IS PRE INCRENEMT?

The pre-increment operator alters the value of the variable before using it in any expression. Therefore, we can say that the pre-increment operator increases the value of the variable first and then use it in the expression.

For an example: initial value of x = 5 find the value of y = ++x ?

                Here first increment happens so know x = x + 1 = 5 + 1 = 6 (x = 6).

                Then the value of x is assigned  to y(y = 6).

                Here x = 6 and y = 6


WHAT IS POST INCREMENT?

The post-increment operator is used when it is required to increment the value of the variable after evaluating the expression. Therefore, in post-increment value is first used in the expression, and then it is incremented.

For an example: initial value of x = 5. find the value of y = x++ ?

                Here first the initial value of x is assigned to y(y = 5).

                After that the increment happens. So know x = x + 1 = 5 + 1 = 6 (x = 6).

                finally y = 5 and x = 6.

      Note : In Pre-Increment, the operator sign (++) comes before the variable. It increments the value of a variable before assigning it to another variable.
        Note : In Post-Increment, the operator sign (++) comes after the variable. It assigns the value of a variable to another variable and then increments its value.

 This function is also same to the pre decrement and post decrement function.