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
how to make a scientific calculater ?
What is else if ladder?
What is a lvalue
When c language was developed?
What is unary operator?
What is difference between array and pointer in c?
Write a program in "C" to calculate the root of a quadratic equation ax^2+bx+c=0, where the value of a,b & c are known.
How can I avoid the abort, retry, fail messages?
Why array is used in c?
What is the use of getch ()?
How can you determine the size of an allocated portion of memory?
What does == mean in texting?
Write program to remove duplicate in an array?
How do you sort filenames in a directory?
What is nested structure with example?