Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Plastic moving to the left
Plastic moving to the left
Friend, let me tell you the answer! Inta// Define a plastic data according to your requirements.

The assignment of a bit can only be 1 or 0.

Let's get started:

1. Assign the third bit of A to 1.

a | =(0x 0 1 & lt; & lt3); //a or equal to 1 shifts 3 bits to the left, ensuring that other bits remain unchanged, and bit3 is assigned to 1.

2. clear biit3 of a.

a & amp= ~(0x 0 1 & lt; & lt3); //a is equal to (1 inverted after shifting 3 bits to the left), thus ensuring that other bits remain unchanged and bit 3 is cleared.

I hope I can help you!