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
What is binary tree in c?
How many parameters should a function have?
Find duplicates in a file containing 6 digit number (like uid) in O (n) time.
What are multidimensional arrays?
What is optimization in c?
Describe newline escape sequence with a sample program?
Why does not c have an exponentiation operator?
write a program which the o/p should b in such a way that s triangle if I/p is 3,a Square/rectangle if I/P=4,a pentagon if I/P=5 and so on...forget about the I/P which is less than 3
Explain enumerated types in c language?
Can a variable be both constant and volatile?
What is the meaning of typedef struct in c?
write a program to convert a expression in polish notation(postfix) to inline(normal) something like make 723+* (2+3) x 7 (not sure) just check out its mainly printing expression in postfix form to infix.
What is indirection?
Which of these functions is safer to use : fgets(), gets()? Why?
Explain what are multibyte characters?