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
What does sizeof return c?
Can you apply link and association interchangeably?
the constant value in the case label is followed by a a) semicolon b) colon c) braces d) none of the above
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
please help me..... please codes and flowchart plz turbo c lang po yan.....please asap response... 3. Make an astrology program. The user types in his or her birthday (month, day, and year as integer), and the program responds with the user’s zodiac sign, horoscope, and other information related to it. If the user’s birth year falls into a leap year, your program should display an appropriate message for it. NOTES: Conditional Statements: it should be with graphics
What is the best style for code layout in c?
I have written a pro*C program to fetch data from the cursor. where in i have used the concept of BULK FETCH.... each FETCH statement is taking lots of time to fetch specified number of rows at...
What is difference between main and void main?
Explain how do you convert strings to numbers in c?
What does emoji p mean?
How can I determine whether a machines byte order is big-endian or little-endian?
Can we initialize extern variable in c?
What are the preprocessor categories?
Is javascript written in c?
Give a one-line C expression to test whether a number is a power of 2. [No loops allowed - it's a simple test.]