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
Why is it that not all header files are declared in every C program?
What is dynamic variable in c?
What is a structure member in c?
What is volatile variable in c with example?
Explain how can I pad a string to a known length?
What is scope rule of function in c?
Write the test cases for checking a variable having value in range -10.0 to +10.0?
Write a program to print factorial of given number without using recursion?
How can I change their mode to binary?
Is c object oriented?
Are global variables static in c?
write a c program to print the next of a particular no without using the arithmetic operator or looping statements?
Write a program to check palindrome number in c programming?
What is the best way to store flag values in a program?
Explain what is a static function?