What will be output if you will compile and execute the following c code?
struct marks{
int p:3;
int c:3;
int m:2;
};
void main(){
struct marks s={2,-6,5};
printf("%d %d %d",s.p,s.c,s.m);
}
(a) 2 -6 5
(b) 2 -6 1
(c) 2 2 1
(d) Compiler error
(e) None of these
Answer: (c)
Explanation:
Binary value of 2: 00000010 (Select three two bit)
Binary value of 6: 00000110
Binary value of -6: 11111001+1=11111010
(Select last three bit)
Binary value of 5: 00000101 (Select last two bit)
Complete memory representation:

nice blog.really appreciate your work. wallpapers collection
Thanks buddy. So please promote it as much as you can :)
i too have given the written apti of tally and was asked this ques..it was easy if u have the concepts of bits in structures and it is explained in yashwant kanithkar..but the way u represented by pictures will make people understand it easily. nice work .
thanks buddy!
But being true, This work is not done by me.
I have taken it from somewhere.
But ya this question was asked to me in tally intwerview :)