How to Clear last bit if it 1 using Macro TURN_OFF_BIT_LAST

Answers were Sorted based on User's Feedback



How to Clear last bit if it 1 using Macro TURN_OFF_BIT_LAST..

Answer / mohit jain

#define TURN_OFF_BIT_LAST(x) ((x) & ~1)

Is This Answer Correct ?    27 Yes 1 No

How to Clear last bit if it 1 using Macro TURN_OFF_BIT_LAST..

Answer / asdf

#define TURN_OFF_BIT_LAST(x) ((~0) << 1) & x)

Is This Answer Correct ?    2 Yes 1 No

How to Clear last bit if it 1 using Macro TURN_OFF_BIT_LAST..

Answer / narendra

#define TURN_OFF_BIT_LAST(x) ((~0) >> 1) & x)
in the question it is asking to clear MSB not LSB

Is This Answer Correct ?    1 Yes 0 No

How to Clear last bit if it 1 using Macro TURN_OFF_BIT_LAST..

Answer / dorian

#define TURN_OFF_BIT_LAST(x) ((x >> 1) << 1)

Is This Answer Correct ?    2 Yes 4 No

How to Clear last bit if it 1 using Macro TURN_OFF_BIT_LAST..

Answer / manoj

#define TURN_OFF_BIT_LAST(x) ((x) & 1) ? ((x) &= ((~0) <<
1)):(x)=(x)

Is This Answer Correct ?    0 Yes 2 No

How to Clear last bit if it 1 using Macro TURN_OFF_BIT_LAST..

Answer / raj

n&0x11111110

Is This Answer Correct ?    4 Yes 9 No

Post New Answer

More C Interview Questions

Explain what is the difference between declaring a variable and defining a variable?

1 Answers  


Meaning of () in c

1 Answers  


What is Full Form of C and Why We use C

23 Answers  


What is dynamic memory allocation?

0 Answers  


What is bss in c?

0 Answers  






What is the best organizational structure?

0 Answers  


What Is The Difference Between Null And Void Pointer?

0 Answers   TCS,


Write a program to print the prime numbers from 1 to 100?

7 Answers  


What is the Purpose of 'extern' keyword in a function declaration?

0 Answers  


What functions are in conio h?

0 Answers  


What is null character in c?

0 Answers  


what is a c-language.what is do.

4 Answers   HCL,


Categories