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 a static function in c?

1108


How can you call a function, given its name as a string?

1103


What are the different types of linkage exist in c?

976


Describe how arrays can be passed to a user defined function

1227


What is the sizeof () operator?

1024


Can you define which header file to include at compile time?

985


What is a protocol in c?

951


What is identifiers in c with examples?

1124


ATM machine and railway reservation class/object diagram

5194


Explain how do you search data in a data file using random access method?

1073


Is c is a middle level language?

1015


How can you invoke another program from within a C program?

1026


What is use of pointer?

1013


What is clrscr in c?

1078


How to implement a packet in C

2836