I think it is because bit1 is only 1 bit fwide and whn u initialize it to
1,since MSB is 1 it treats it as a negative integer...Plz correct me if i am
wrong...

On Tue, Aug 9, 2011 at 12:24 PM, Rohit Srivastava <[email protected]>wrote:

> #include<stdio.h>
> #include<conio.h>
>
> int main()
> {
>     struct value
>     {
>         int bit1:1;
>         int bit3:4;
>         int bit4:4;
>     }bit={1,2,2};
>     printf("%d %d %d\n",bit.bit1,bit.bit3,bit.bit4);
>     getche();
>     return 0;
> }
>  the above code gives output : -1 2 2
> any idea why???
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Aditi Garg
Undergraduate Student
Electronics & Communication Divison
NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
Sector 3, Dwarka
New Delhi

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to