(Solved):Write code to implement the following function: /* Return 1 when any odd bit of x equals 1; 0 otherwise assume w=32 */ int any_odd_one(unsigned x); You may assume that data type int has w=32 bi… View Answer…

 

Question

Write code to implement the following function:

/* Return 1 when any odd bit of x equals 1; 0 otherwise

assume w=32 */

int any_odd_one(unsigned x);

You may assume that data type int has w=32 bits.

 

EXPERT ANSWER

A program in Programming Language C++ to checks if one is present at an odd location.

#include <iostream>
using namespace std;
int any_odd_one(unsigned x) // method to check status
{
    int flag = false;
    int i, xBin[32];
    for(i

Scroll to top