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

how to capitalise first letter of each word in a given string?

1983


What is malloc() function?

1235


What is the difference between malloc calloc and realloc in c?

1190


Explain how can I remove the trailing spaces from a string?

1104


What is wild pointer in c with example?

1111


Why C language is a procedural language?

1095


A character flag or control mechanism that delineates one data item from another a) variable b) constant c) delimiter d) call by reference

1151


When we use void main and int main?

1130


What is a const pointer?

1196


#include main() { int *p, *c, i; i = 5; p = (int*) (malloc(sizeof(i))); printf(" %d",*p); *p = 10; printf(" %d %d",i,*p); c = (int*) calloc(2); printf(" %d ",*c); }

1105


Why do we use main function?

1236


What is array of structure in c programming?

1333


What is difference between constant pointer and constant variable?

1402


What is operator precedence?

1282


Process by which one bit pattern in to another by bit wise operation is?

1225