Computers and Technology

Suppose we number the bits in a 32-bit word from 0 (least significant) to 31 (most significant). Write code for the following C function that will return 1 if x has at least one bit with a value of 1 at an odd index, 0 otherwise: int oddBit(unsigned int x);
Here are some test runs:

oddBit (Oxl): 0 oddBit (0x2): 1
oddBit (0x3): 1 oddBit (0x4): 0
oddBit (0x): 1
oddBit (Ox): 1
oddBit (Ox55555555): 0

Use only bitwise and logical operators (&&, 11, !); no if statements, loops, arithmetic operators (+,-, *,7,%), or conditional operators (==, !=, etc). Also write a main() function to test your function. Hint: use a bit mask to isolate the odd bits, and think about the effect of a logical not (or two) on an int in C. Comment your code, including every line that uses a bitwise operator.

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 01:00, keasiabradley
Search the web for two examples of digital art that you like. the examples must be from different mediums (example: one digital photo and one computer animation not two computer animations). compose an essay for each example you choose about why the piece appeals to you, and identify the medium used.
Answers: 1
image
Computers and Technology, 22.06.2019 10:30, ghazanfarwaheed7967
Auniversity wants to install a client-server network. which feature do you think is important for them as they set up the network? sending email blocking multiple people to use the same file low security low set up cost limited access to files
Answers: 1
image
Computers and Technology, 22.06.2019 15:00, yeet74
I'm taking a class on how to make a movie, and it offers some apps that would be in the process. the thing is, i don't have any of those ha. if you have any tips on some apps i could use, that would be awesome. i don't have an iphone, so don't suggest any apps like imovie. i know that this is a weird question, but it would be super for me. : )
Answers: 2
image
Computers and Technology, 23.06.2019 06:30, QueeeenUknown7437
How do you write an argumentative essay about the importance of free enterprise ?
Answers: 1
Do you know the correct answer?
Suppose we number the bits in a 32-bit word from 0 (least significant) to 31 (most significant). Wri...

Questions in other subjects: