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
Explain function?
What is realloc in c?
the number of measuring units from a arbitrary starting point in a record area or control block to some other point a) branching b) recording pointer c) none d) offset
What is a dynamic array in c?
How do you convert a decimal number to its hexa-decimal equivalent.Give a C code to do the same
Which operators cannot be overloaded a) Sizeof b) .* c) :: d) all of the above
What is a rvalue?
What is a function in c?
Write the program that calculates and prints the average of several integers. Assume that the last value read is sentinel 9999.
What is a macro, and explain how do you use it?
What are the modifiers available in c programming language?
What is a loop?
Explain what is the difference between functions getch() and getche()?
In cryptography, you could often break the algorithm if you know what was the original (plain) text that was encoded into the current ciphertext. This is called the plain text attack. In this simple problem, we illustrate the plain text attack on a simple substitution cipher encryption, where you know each letter has been substituted with a different letter from the alphabet but you don’t know what that letter is. You are given the cipherText as the input string to the function getwordSets(). You know that a plain text "AMMUNITION" occurs somewhere in this cipher text. Now, you have to find out which sets of characters corresponds to the encrypted form of the "AMMUNITION". You can assume that the encryption follows simple substitution only. [Hint: You could use the pattern in the "AMMUNITION" like MM occurring twice together to identify this]
Explain what is a 'locale'?