Set a bit:

bitp |= (1 << pos);

Reset or clear:

bitp &= ~(1 << pos);

Toggle a bit:

bitp ^= (1 << pos);
(bitp & (~(1 << pos))) | ((~bitp) & (1 << pos)))

About our authors: Team EQA

You have viewed 1 page out of 248. Your C learning is 0.00% complete. Login to check your learning progress.

Learn on Youtube

#