What is the purpose of the code, and is there any problem
with it?
unsigned int f( unsigned n )
{ return –n & 7; }
f returns the 8's complement of the lower 3 bits of a given number
................................(2's complement of n)&0x07
f(0) => -00000000&00000111 => 00000000&00000111 => 00000000 (0)
f(1) => -00000001&00000111 => 11111111&00000111 => 00000111 (7)
f(2) => -00000010&00000111 => 11111110&00000111 => 00000110 (6)
f(3) => -00000011&00000111 => 11111101&00000111 => 00000101 (5)
f(4) => -00000100&00000111 => 11111100&00000111 => 00000100 (4)
f(5) => -00000101&00000111 => 11111011&00000111 => 00000011 (3)
f(6) => -00000110&00000111 => 11111010&00000111 => 00000010 (2)
f(7) => -00000111&00000111 => 11111001&00000111 => 00000001 (1)
f(8) => -00001000&00000111 => 11111000&00000111 => 00000000 (0)
f(9) => -00001001&00000111 => 11110111&00000111 => 00000111 (7)
f(10) => -00001010&00000111 => 11110110&00000111 => 00000110 (6)
.
.
| Is This Answer Correct ? | 0 Yes | 0 No |
Explain the advantages of using macro in c language?
Can i use Two or More Main Funtion in any C program.?
What does *p++ do?
Difference between constant pointer and pointer to a constant.
How can I sort more data than will fit in memory?
what is the use of using linked list and array?
How can I write data files which can be read on other machines with different word size, byte order, or floating point formats?
What are register variables? What are the advantage of using register variables?
Explain bit masking in c?
Can a variable be both static and volatile in c?
write a c program that if the given number is prime, and their rearrangement(permute) of that number is also prime. Ex: Input is "197" is prime Output: 791,917,179 is also prime. Please any one tell me tha code for that
Derive the complexity expression for AVL tree?