write a c program to change only the 3rd bit of the
particular number such that other bits are not affected..
if bitnum=10(say.. it can be any no..
Answer Posted / om
void toggle_kth_bit_IMPROVED(int *n, int bitToBeChanged)
{
*n=*n^(1<<(bitToBeChanged-1));
}
| Is This Answer Correct ? | 7 Yes | 1 No |
Post New Answer View All Answers
What is unsigned int in c?
What is c basic?
What are variables c?
What is the use of extern in c?
Why calloc is better than malloc?
.find the output of the following program? char*myfunc(char*ptr) { ptr +=3; return (ptr); } int main() { char*x,*y; x="HELLO"; y=myfunc(x); printf("y = %s ",y); return 0; }
What are pointers? What are different types of pointers?
Differentiate between full, complete & perfect binary trees.
Explain how can I avoid the abort, retry, fail messages?
In c programming typeing to occupy the variables in memory space. if not useing the variable the memory space is wasted.ok, how to avoid the situation..? (the variable is used & notused)
Study the following C program :call_me (myvar)int myvar;{ myvar +- 5; }main(){int myvar;myvar = 3;call_me(myvar);printf("%d ",myvar);What will be printed a) 3 b) 5 c) 8 d) symbol
Is boolean a datatype in c?
What is difference between Structure and Unions?
Where define directive used?
Why is c so popular?