CopyBits(x,p,n,y)
copy n LSBs from y to x starting LSB at 'p'th position.
Answer Posted / rakesh
It should be p--, not p++. for example y = 217 (11011001)
and you want to extract the least 4 SB then n = 4 and p = 3
(remember the number start from 0 to 7 in memory). After
executing this you will get x = 9 i.e 1001.
t=0;
for(i=n; i>0; i--)
{
t |= (1<<p);
p--;
}
x=x&~t;
t=t&y;
x=x|t;
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
how to capitalise first letter of each word in a given string?
What is malloc() function?
What is the difference between malloc calloc and realloc in c?
Explain how can I remove the trailing spaces from a string?
What is wild pointer in c with example?
Why C language is a procedural language?
A character flag or control mechanism that delineates one data item from another a) variable b) constant c) delimiter d) call by reference
When we use void main and int main?
What is a const pointer?
#include main() { int *p, *c, i; i = 5; p = (int*) (malloc(sizeof(i))); printf(" %d",*p); *p = 10; printf(" %d %d",i,*p); c = (int*) calloc(2); printf(" %d ",*c); }
Why do we use main function?
What is array of structure in c programming?
What is difference between constant pointer and constant variable?
What is operator precedence?
Process by which one bit pattern in to another by bit wise operation is?