it will be 00. Bit fields are allocated within an integer from least-significant to most-significant bit. In the following code
struct mybitfields { unsigned short a : 4; unsigned short b : 5; unsigned short c : 7; } test; int main( void ); { test.a = 2; test.b = 31; test.c = 0; } the bits would be arranged as follows: 00000001 11110010 cccccccb bbbbaaaa On Mon, Aug 29, 2011 at 10:31 AM, kartik sachan <kartik.sac...@gmail.com>wrote: > @PRATEEK if i make int bit1:2 then it will store 2 bytes > for example if bit1=4;then out will be 0 or 1 > my question is it storing number from least significant bit or most > significant bit??? > suppose for 4 0100 so out will be 00 or 01?? > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- With Regards Manish Patel BTech Computer Science And Engineering National Institute of Technology -Allahabad -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.