一、sum += 1;与sum = sum + 1;是相等的,运算结果相等;
二、用一段代码说明;
cs
# define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main()
{
//初始变量值;
int n1 = 1;
int n2 = 1;
//输出;
printf("运算前的n1=%d,n2=%d", n1, n2);
//换行;
printf("\n");
//运算;
n1 += 1;
n2 = n2 + 1;
//输出;
printf("n1+=1的结果为:%d,n2=n2+1的结果为:%d", n1, n2);
//换行;
printf("\n");
return 0;
}