赋值操作符又叫复合操作符,除了=之外,其他的都是两个一起的,有:’+=‘加法操作符,’-=‘减法操作符,‘*=’乘法操作符,‘/=’除法操作符,‘%=’取余数赋值操作符,’<<=’左移位赋值操作符,‘>>=’右移位操作符,‘&=’位与赋值操作符,‘^=’位异或赋值操作符,‘|=’按位或赋值操作符。

#include<stdio.h>
int main()
{
int a = 2;
a +=1;
printf("a=%=%d\n",a);
return 0;
}
#include<stdio.h>
int main()
{
int a = 2;
a -=1;
printf("a=%=%d\n",a);
return 0;
}
#include<stdio.h>
int main()
{
int a = 2;
a *=4;
printf("a=%=%d\n",a);
return 0;
}
#include<stdio.h>
int main()
{
int a = 2;
a /=2;
printf("a=%=%d\n",a);
return 0;
}
#include<stdio.h>
int main()
{
int a = 7;
a %=2;
printf("a=%=%d\n",a);
return 0;
}
#include<stdio.h>
int main()
{
int a = 9;
a <<=1;
printf("a=%=%d\n",a);
return 0;
}
#include<stdio.h>
int main()
{
int a = 6;
a >>=1;
printf("a=%=%d\n",a);
return 0;
}
#include<stdio.h>
int main()
{
int a = 5;
a &=1;
printf("a=%=%d\n",a);
return 0;
}
#include<stdio.h>
int main()
{
int a = 5;
a ^=1;
printf("a=%=%d\n",a);
return 0;
}
#include<stdio.h>
int main()
{
int a = 2;
a |=1;
printf("a=%=%d\n",a);
return 0;
}