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,
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


Please Help Members By Posting Answers For Below Questions

Is c compiled or interpreted?

1128


Function calling procedures? and their differences? Why should one go for Call by Reference?

1041


Is null a keyword in c?

1138


What is the package for freshers(Non IIT) in amazon(hyderabad). And what is the same for those who are a contract employee.

4241


How are variables declared in c?

1028


write a progrmm in c language take user interface generate table using for loop?

1996


How can I change the size of the dynamically allocated array?

1092


Is c procedural or object oriented?

953


What is pragma c?

1059


What is the difference between c and python?

1104


Is it better to bitshift a value than to multiply by 2?

1050


What is output redirection?

1165


In the DOS enveronment, normal RAM that resides beyond the 1mb mark. a) expanded memory b) swapped memory c) Extended memory d) none

1158


Why is python slower than c?

1023


What is difference between %d and %i in c?

1181