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

Bit swapping

Answer Posted / sibnath halder

Assuming that you want to use 8 bits of whatever bytes you
have, you could use

char swapbyte(unsigned char c)
{ unsigned char result=0;
for(int i=0;i<8;++i)
{ result=result<<1;
result|=(c&1);
c=c>>1;
}
return result;
}

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

please can any one suggest me best useful video tutorials on c i am science graduate.please help me.u can email me to sas29@in.com

1722


Explain what is the concatenation operator?

1108


Why isnt any of this standardized in c?

1020


Please send me WIPRO technical question to my mail ID.. its nisha_g28@yahoo.com please its urgent

2074


how to write a c program to print list of fruits in alpabetical order?

2241


What are the parts of c program?

1041


List the difference between a 'copy constructor' and a 'assignment operator' in C?

1034


What is a const pointer?

1040


How do I determine whether a character is numeric, alphabetic, and so on?

1070


What is substring in c?

1132


#include main() { enum _tag{ left=10, right, front=100, back}; printf("left is %d, right is %d, front is %d, back is %d",left,right,front,back); }

1067


Why do we use int main instead of void main in c?

1100


How will you divide two numbers in a MACRO?

1083


What does stand for?

1045


Is array a primitive data type in c?

1001