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

What is self-referential structure in c programming?

662


what is bit rate & baud rate? plz give wave forms

1523


c program to compute AREA under integral

1816


Differentiate between functions getch() and getche().

627


can anyone suggest some site name..where i can get some good data structure puzzles???

1646






Why is c still so popular?

619


What is the difference between formatted&unformatted i/o functions?

620


a character or group of characters that defines a register,or a part of storage a) memory b) byte c) address d) linear list

634


in any language the sound structure of that language depends on its a) character set, input/output function, its control structures b) character set, library functions, input/output functions its control structures c) character set, library functions, control sturctures d) character set, operators, its control structures

679


What is a null pointer in c?

601


Study the following C program :call_me (myvar)int myvar;{ myvar +- 5; }main(){int myvar;myvar = 3;call_me(myvar);printf("%d ",myvar);What will be printed a) 3 b) 5 c) 8 d) symbol

669


What is the usage of the pointer in c?

608


Explain how can you restore a redirected standard stream?

594


Is there a built-in function in C that can be used for sorting data?

749


Explain what are the __date__ and __time__ preprocessor commands?

596