How to Clear last bit if it 1 using Macro TURN_OFF_BIT_LAST
Answers were Sorted based on User's Feedback
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 |
Answer / manoj
#define TURN_OFF_BIT_LAST(x) ((x) & 1) ? ((x) &= ((~0) <<
1)):(x)=(x)
| Is This Answer Correct ? | 0 Yes | 2 No |
pgm to reverse string using arrays i.e god is love becomes love is god) (assumption:only space is used for seperation of words) no addtional memory used.i.e no temporary arrays can used.
What is pragma c?
What's the difference between struct x1 { ... }; and typedef struct { ... } x2; ?
While(1) { } when this loop get terminate is it a infinite loop?
What is the purpose of clrscr () printf () and getch ()?
What are the types of macro formats?
what is disadvantage of pointer in C
What is || operator and how does it function in a program?
A.C func() { pritnf(" in fuction %d",MACRO); } MAIN.c testfunc() { #define MACRO 10 printf("in test function %d", MACRO); } main() { printf("in main %d",MACRO); func(); testfunc(); getch(); }
What is function pointer and where we will use it
what are bitwise shift operators?
the real constant in c can be expressed in which of the following forms a) fractional form only b) exponential form only c) ascii form only d) both a and b