Section 12 Self-increment and self-decrement (++ --)

1. Procedure

#include <stdio.h>
int main()
{
    
    
	int i = 3, j;
	j = ++i;
	printf("%d %d", i, j); //4 4
}
#include <stdio.h>
int main()
{
    
    
	int i = 3, j;
	j = i++;
	printf("%d %d", i, j); //4 3
}
#include <stdio.h>
int main()
{
    
    
	int i = 3;
	printf("%d\n", i++); //++i 4,4
	printf("%d\n", i); //3 4
}

2. Summary
①The program is concise/efficient
②It cannot be used for constants
③Avoid confusing
3. Self-test

Guess you like

Origin blog.csdn.net/m0_51439429/article/details/114462364