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
#include show(int t,va_list ptr1) { int a,x,i; a=va_arg(ptr1,int) printf(" %d",a) } display(char) { int x; listptr; va_star(otr,s); n=va_arg(ptr,int); show(x,ptr); } main() { display("hello",4,12,13,14,44); }
What is extern storage class in c?
What does it mean when the linker says that _end is undefined?
what is recursion in C
What is the incorrect operator form following list(== , <> , >= , <=) and what is the reason for the answer?
Which one would you prefer - a macro or a function?
How can I run c program?
What oops means?
What is signed and unsigned?
Write a c program to build a heap method using Pointer to function and pointer to structure ?
Why is a semicolon (;) put at the end of every program statement?
What is the process of writing the null pointer?
What is identifier in c?
When I set a float variable to, say, 3.1, why is printf printing it as 3.0999999?
Which function in C can be used to append a string to another string?