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

How can I get Single byte from 'int' type variable? Can we
alter single bit or multiple bits in int type variable? if so,
How?

Answer Posted / hassan noureddine

Use bit wise unary commands:

int i = 0x5678
char LowByte = (char) i; // yield 8;

To alter the bits

i &= 0xFF; // reset upper 2 bytes
i ^= 0xFFFF // invert all bits

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why is it that not all header files are declared in every C program?

1211


What is dynamic variable in c?

1026


What is a structure member in c?

995


What is volatile variable in c with example?

1036


Explain how can I pad a string to a known length?

1189


What is scope rule of function in c?

1084


Write the test cases for checking a variable having value in range -10.0 to +10.0?

2316


Write a program to print factorial of given number without using recursion?

985


How can I change their mode to binary?

1108


Is c object oriented?

961


Are global variables static in c?

1159


write a c program to print the next of a particular no without using the arithmetic operator or looping statements?

3941


Write a program to check palindrome number in c programming?

1010


What is the best way to store flag values in a program?

1069


Explain what is a static function?

1101