Page 37 - 6437
P. 37
&= Bitwise AND assignment operator. C &= 2 is same as
C
= C & 2
^= Bitwise assign is
exclusive R nd ment = C ^ same as
operator.
|= Bitwise assign same
inclusive R nd ment C = 2 s as C
operator.
2
Example
Try the following example to understand all the assignment operators available in C:
#include <stdio.h>
main()
{
int a = 21;
int c ;
c = a;
printf(" Op Ex %
Line = erator ample, alue f d\n", ;
c +=
a; Op Ex %
printf("Line += erator ample, alue f d\n", ;
c -=
a; Op Ex %
printf("Line -= erator ample, alue f d\n", ;
c *=
a;
printf("Line Op Ex %
*= erator ample, alue f d\n", ;
39