- Bitwise operator work on bits
- Turbo c is a 16 bit compiler. Due to this the bitwise operator are limited to 16 bits only.
- Bitwise operators only on integer type value.
- When the first bit [sign bit] is ‘1’ then the number is negative or ‘O’ then the number is positive.

#### Note:

Bitwise operators are with label feature.

C language supports the following bitwise operators.

& – Bitwise and

| – Bitwise or

^ – xor, Exclusive or

~ – Complement operator

<< – Left shift operator

>> – Right shift operator

**& – Bitwise and: –**

In this both bits are 1βs then result bit is β1β then otherwise result bit is β0β.

Ex: –

25 & 15 = 9

**| – Bitwise or**

In this both bits are 0βs then result bit is 0 otherwise result bit is 1.

Ex: –

25 | 15=31

**^ – xor, Exclusive or Operator**

In this both bits are same then result bit is β0β otherwise result bit is β1β.

Ex: –

25 ^ 15=22

**~ – Complement operator:-**

In complement operator the bit are complimented.

i.e 1βs become 0βs and 0βs become 1βs. due to this +ve number become βve and -ve number +ve.

EX:-

~ +25 == > -26

~ -25 == >+24

<< – Left shift operator:-

In left shift operator the specified number of bit are deleted from left side and the same number of zeros are added on right side. In left shift operation, most operation, most probable the value is multiplied with 2 that number of times.

Ex; –

25<<1=50

25<<2=100

25<<15=32768

25<<16=0

**>> – Right shift operator:-**

In right shift operator the bits are moved to right side.

I.e. the specified number of bits is deleted from right side and same number of zeroβs is added left side. Due to this always the number is divided with 2 that number of time.

Ex:-

25>>1=12

25>>2=6

25>>3=3

25>>4=1

25>>5=0