C program to print bits of an integer




















No ; this just copies x into i. Unless you meant this as a joke? Is this what you're looking for? Kevin Kevin Moderator Note I tried to purge antagonistic or otherwise non constructive comments under this answer selectively, and I ended up with a very broken conversation. All comments were purged. Please keep comments professional, constructive and most of all on topic. If the OP wanted to remove this, the OP would have removed it by now.

If you disagree with this answer, then vote. If you can improve this answer, edit. Really, we're adults, yes? I almost checked the ages on all that commented here to make sure everyone was over Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Stack Gives Back Safety in numbers: crowdsourcing data on nefarious IP addresses.

Featured on Meta. New post summary designs on greatest hits now, everywhere else eventually. Linked 0. See more linked questions. Related Hot Network Questions. Question feed. Stack Overflow works best with JavaScript enabled. Count positions in Binary Matrix having equal count of set bits in corresponding row and column.

Sum of numbers obtained by the count of set and non-set bits in diagonal matrix elements. Article Contributed By :. Easy Normal Medium Hard Expert. Writing code in comment? Please use ide. Load Comments. What's New. Most popular in Bit Magic. More related articles in Bit Magic. We use cookies to ensure you have the best browsing experience on our website.

Start Your Coding Journey Now! Asked 9 years, 11 months ago. Active 1 month ago. Viewed 78k times. I am trying to write a program in C that prints bits of int. Improve this question. Is this what you want? Is that really the output, or is the formatting broken? It doesn't match the print statements Oh, and you don't say what value you're passing in for num , either — Useless.

Useless fixed question, output is for printBits 3. Add a comment. Active Oldest Votes. Improve this answer. Sergey Kalinichenko Sergey Kalinichenko k 71 71 gold badges silver badges bronze badges. Please don't spell!! It's hard to read.

Adam Davis Adam Davis 89k 57 57 gold badges silver badges bronze badges. I'm still struggling to understand endianess, but am I right thinking that this prints bits in "big endian", as opposed to "little endian" which is more common? The value 1 in 16 bits it will either be or depending on Endianess. It is not mirrored like in your example.



0コメント

  • 1000 / 1000