Thread: Bitwise operators in C.

  1. #1
    Banned
    Join Date
    Apr 2015
    Posts
    596

    Bitwise operators in C.

    Hi, I've read bitwise operators in C programming but I don't know yet how to work with them properly in C codes. ( I know the bitwise operator definitions, the rules of using them, also how they work in c)
    My problem is, using the bitwise operators while coding which sometimes stuck me hours just for figuring out the proper idea beyond using bitwise operators!!,lets take an easy example and try to solving it together.
    -----------------------------------------------------------------------------

    I'm struggling in this question about half hour, which it simplifies to print "1" if the given number is multiple of 3, else printf "it's not multiple of 3". ( the solution must be by bitwise operators and shifting...not by arithmetic maths!) ; by the way- the question is just for understanding the bitwise operators && shifting, so it's not a homework or something!!

    So how can I code this? I've no clue how to get started in coding this!

    thanks in advance for your cooperation!

  2. #2
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,738
    Here is a nice link. It should be easy to change it for your program:
    Check if a number is multiple of 9 using bitwise operators - GeeksforGeeks
    Devoted my life to programming...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Bitwise operators help ~
    By Siaw Ys in forum C Programming
    Replies: 7
    Last Post: 12-11-2011, 02:02 AM
  2. bitwise operators
    By manzoor in forum C++ Programming
    Replies: 12
    Last Post: 08-18-2008, 02:43 PM
  3. Bitwise Operators, Help!!
    By Mini__C in forum C Programming
    Replies: 6
    Last Post: 07-14-2004, 04:20 PM
  4. Bitwise operators
    By Unregistered in forum C Programming
    Replies: 22
    Last Post: 03-24-2004, 11:03 AM
  5. Bitwise operators
    By kerrywolfe in forum C++ Programming
    Replies: 2
    Last Post: 02-09-2002, 05:57 PM