CopyBits(x,p,n,y)
copy n LSBs from y to x starting LSB at 'p'th position.
Answer Posted / vadivel t
Hi,
Small bug is there in the above code, which i have posted.
But the same has been resolved here.
#include<stdio.h>
#include<conio.h>
int main()
{
int x, y, n , p, i, j, temp;
printf("ENTER X, Y, NO OF BITS AND BIT POSITION: \n");
scanf("%d %d %d %d",&x, &y, &n, &p);
for(i = p, j = 0; i < n+p; i++, j++)
{
if(x & (0x01 << i-1))
x = x^(0x01 << i-1);
temp = y & (0x01 << j) ? 1 : 0;
x = x | (temp << i-1);
}
printf("VALUE OF X:%d \n",x);
getch();
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Is c compiled or interpreted?
Function calling procedures? and their differences? Why should one go for Call by Reference?
Is null a keyword in c?
What is the package for freshers(Non IIT) in amazon(hyderabad). And what is the same for those who are a contract employee.
How are variables declared in c?
write a progrmm in c language take user interface generate table using for loop?
How can I change the size of the dynamically allocated array?
Is c procedural or object oriented?
What is pragma c?
What is the difference between c and python?
Is it better to bitshift a value than to multiply by 2?
What is output redirection?
In the DOS enveronment, normal RAM that resides beyond the 1mb mark. a) expanded memory b) swapped memory c) Extended memory d) none
Why is python slower than c?
What is difference between %d and %i in c?