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

general for is %wd,f-d; in this system "w" means a) 'w' represent total width of digits b) 'w' represent width which includes the digits before,after decimal place and the decimal point c) 'w' represent width which includes the digits before only d) 'w' represent width after decimal place only

0 Answers  


What is zero based addressing?

0 Answers  


Should I use symbolic names like true and false for boolean constants, or plain 1 and 0?

0 Answers  


to find the closest pair

0 Answers   Infosys,


Tell us two differences between new () and malloc ()?

0 Answers   Adobe,






When is a null pointer used?

0 Answers  


What is the difference between int main and void main?

0 Answers  


When do you say that a digraph is acyclic A)if and only if its first search does not have back arcs B)a digraph is acyclic if and only if its first search does not have back vertices C)if and only if its first search does not have same dfnumber D)None of these

1 Answers   Accenture, IBM,


Compare and contrast compilers from interpreters.

0 Answers  


do ne body have any idea about the salary for the we r going to have interview. yup .. u got it right ..i m talking abt NIC.

1 Answers  


What are keywords in c with examples?

0 Answers  


How to implement a packet in C

0 Answers   Aricent,


Categories