Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

a value that does not change during program execution a) variabe b) argument c) parameter d) none

1296


What is the best way to store flag values in a program?

1127


Are local variables initialized to zero by default in c?

1103


What is the heap?

1266


What is the difference between text files and binary files?

1400


Explain what are header files and explain what are its uses in c programming?

1206


What is array of structure in c?

1254


Are comments included during the compilation stage and placed in the EXE file as well?

1130


what is reason of your company position's in india no. 1.

2413


What does d mean?

1172


How can I implement a delay, or time a users response, with sub-second resolution?

1121


What is c language in simple words?

1117


What is a pointer in c plus plus?

1388


praagnovation

2354


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)

2176