0
1.1kviews
State all logical operators used in C and explain any one with example.
1 Answer
written 5.9 years ago by | • modified 5.9 years ago |
Symbol | Name | Example |
---|---|---|
~ | Not | P0=~P0 ;P0=0xff will give P0=0x00 |
^ | XOR | ACC ^ P1 = 0 x 02 ^ 0 xF3 = 0 x F1 |
I | OR | ACC I P1 = 0 x 02 I 0 xF3 = 0 x F3 |
& | AND | ACC & P1 = 0 x 02 & 0 xF3 = 0 x 02 |
. > > | Right shift | P0= P0>>1 ;P0=0x01 will give 0x00; |
< < | Left shift | P0= P1<<1 ;P0=0x01 will give 0x02; |