CopyBits(x,p,n,y)
copy n LSBs from y to x starting LSB at 'p'th position.
Answer Posted / vadivel t
Hi,
The below code ll giv desired o/p.
#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))
x = x^(0x01<<i);
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
a value that does not change during program execution a) variabe b) argument c) parameter d) none
What is the best way to store flag values in a program?
Are local variables initialized to zero by default in c?
What is the heap?
What is the difference between text files and binary files?
Explain what are header files and explain what are its uses in c programming?
What is array of structure in c?
Are comments included during the compilation stage and placed in the EXE file as well?
what is reason of your company position's in india no. 1.
What does d mean?
How can I implement a delay, or time a users response, with sub-second resolution?
What is c language in simple words?
What is a pointer in c plus plus?
praagnovation
In c programming typeing to occupy the variables in memory space. if not useing the variable the memory space is wasted.ok, how to avoid the situation..? (the variable is used & notused)