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 can you tell whether a program was compiled using c versus c++?
What is the difference between āgā and āgā in C?
What are extern variables in c?
What is ctrl c called?
What is optimization in c?
Explain what is a stream?
What is NULL pointer?
write a program to find out prime number using sieve case?
Differentiate between #include<...> and #include '...'
What is modifier & how many types of modifiers available in c?
What does c mean before a date?
An arrangement of information in memory in such a way that it can be easily accessed and processed by a programming language a) string b) data structure c) pointers d) array
is it possible to create your own header files?
Explain how can you determine the size of an allocated portion of memory?
ATM machine and railway reservation class/object diagram