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 are the 4 types of functions?
Explain indirection?
Is there anything like an ifdef for typedefs?
What is struct node in c?
Describe explain how arrays can be passed to a user defined function
Is it better to use a macro or a function?
How can you find out how much memory is available?
What is the difference between ++a and a++?
When do we get logical errors?
Explain about C function prototype?
Explain the concept and use of type void.
Is it better to use malloc() or calloc()?
How can I make sure that my program is the only one accessing a file?
Write a program to print ASCII code for a given digit.
what is the c source code for the below output? 5555555555 4444 4444 333 333 22 22 1 1 22 22 333 333 4444 4444 5555555555