Question: IN C PROGRAMMING: #define BIT(n) (i < < (n)) #define IS_SET(v, n) ( ((v) & BIT(n)) != 0 ) #define BIT_SET(v,n) ( v|= BIT(n) )

IN C PROGRAMMING:

#define BIT(n) (i << (n)) #define IS_SET(v, n) ( ((v) & BIT(n)) != 0 ) #define BIT_SET(v,n) ( v|= BIT(n) ) #define BIT_CLEAR(v,n) (v &= ~(BIT(n)) )

Using these macros, write a function that prints an unsigned int in binary:

void binaryprint(unsigned int x1)

{

// Iteration of i from 31 down to 0 (assume 32 bits for the unsigned int)

// if ith bit in x is set, print 1, else print 0

// print a new line after.

}

In the main function, implement the above macros, call the function binaryprint and make sure that the macros work!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!