/*
赋值运算符:=
复合赋值运算符:(双目运算符) 一次性做两件事情 先运算 再赋值
+= a+=3;-->a = a + 3
-=
*=
/=
%=
*/
#include <stdio.h>
int main(int argc, const char * argv[]) {
int a =3 ,b = 4;
//表达式
a + b; //7
a+3; //6
printf("a = %d\n",a);//3
//做了个赋值
a = a + b; //7
a +=b; //a = a + b
printf("a = %d\n",a);//7//11
a = a + 3; //10
a += 3; //a = a + 3
// a += 7
// a = a + 7
a += b +3; //a = a + (b + 3)
printf("a = %d\n",a); //10//17
return 0;
}
|
|