A brief description of the increment and decrement operators

I always forget ++i and how to use i++. Here is a simple small program to explain

 int i=0,j=0;
 j=++i; //j=1,i=1
 j=i++; //j=1,i=2

The difference between the two is the pre and post of the sign of increment and decrement. "++" predeclares adding 1 before the value of i is not used, and post declaring self increment and decrement after the value of i is used. . Post-positioning is only used when necessary

Guess you like

Origin blog.csdn.net/qq_41803340/article/details/108714431