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 / rakesh

It should be p--, not p++. for example y = 217 (11011001)
and you want to extract the least 4 SB then n = 4 and p = 3
(remember the number start from 0 to 7 in memory). After
executing this you will get x = 9 i.e 1001.

t=0;
for(i=n; i>0; i--)
{
t |= (1<<p);
p--;
}
x=x&~t;
t=t&y;
x=x|t;

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is derived datatype in c?

1097


How do you determine whether to use a stream function or a low-level function?

1124


which is conditional construct a) if statement b) switch statement c) while/for d) goto

1217


When I set a float variable to, say, 3.1, why is printf printing it as 3.0999999?

1067


What is pre-emptive data structure and explain it with example?

3726


What type of function is main ()?

1041


What is the difference between fread and fwrite function?

1081


Why do we use int main?

1101


How does free() know explain how much memory to release?

1052


Write a program for Overriding.

1158


What is the process of writing the null pointer?

1028


What is malloc return c?

1023


What is non linear data structure in c?

1027


write a c program to calculate sum of digits till it reduces to a single digit using recursion

3312


How many types of functions are there in c?

1142