Browsing all articles tagged with bit-wise operator - Share Programming Tips
Sep
25

How to set, clear ,toggle and check a single bit in C?

As being an embedded software engineer i would really suggest you this tricks. ..!  In many  application you need to deal with this bit wise operation. Sometimes you know this all stuff very well but still some time it takes  time to construct this logic or some time you got some mistakes in it. so i suggest you to paste this on your desk until you paste this in your mind..!

To set a bit

Use the bitwise OR operator (|) to set a bit.

 number |= 1 << x; 

That will set bit x.

read more

Follow us on Twitter! Follow us on Twitter!

Search in this website

our sponsors

latest comments

Find us on Facebook

Top Authors

35 posts
saurabh
21 posts
9 posts

Find us on stackoverflow

Polls

Tell us who you are

View Results

Loading ... Loading ...

My Bookmarks

Sponsers Link