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 the concatenation operator?
How do you use a 'Local Block'?
What is c definition?
What is a #include preprocessor?
What is meant by realloc()?
What is a lookup table in c?
Write a program to print fibonacci series without using recursion?
Explain how can you tell whether a program was compiled using c versus c++?
Is c procedural or functional?
What is the meaning of typedef struct in c?
Explain what are header files and explain what are its uses in c programming?
Given a valid 24 hour format time find the combination of the value and write a program ,do not hard the value and if any other inputs provided should work with the logic implemented Input: 11:30 Output: 13:10 Input: 18:25 Output: 21:58
What is the right type to use for boolean values in c?
How can you find the day of the week given the date?
Why is struct padding needed?