in code after printing i,it should be increment to 1 because i++ is post increment operator first increment then used ,then j should be 1
Don't expect always ready made answers, did you read that document ? if you have read that document then at last of the page same problem is explained but at least show some efforts to read a document.
Joined: Apr 08, 2012
i have seen that prepostdemo class example ,its been incremented with both ++i and i++ ,but with no explanation
The increment/decrement operators can be applied before (prefix) or after (postfix) the operand. The code result++; and ++result; will both end in result being incremented by one. The only difference is that the prefix version (++result) evaluates to the incremented value, whereas the postfix version (result++) evaluates to the original value. If you are just performing a simple increment/decrement, it doesn't really matter which version you choose. But if you use this operator in part of a larger expression, the one that you choose may make a significant difference.
The following program, PrePostDemo, illustrates the prefix/postfix unary increment operator:
It is explained well, you can't see ?
Even without explanation you can see output differences here.