@jalaj endian specific. Anurag Sharma
On Sun, Jun 13, 2010 at 11:54 PM, Modeling Expert < [email protected]> wrote: > @jalaj > > Yes , this is endian ness specific. On windows/x86 linux which are > little endian, ch[0] would be lower 8 bits. On solaris/power pc which > are big endian this would be upper 8 bits. e.g. > union a temp; > temp.i = 0x12345678 //! here big end is 0x12 and little end is 0x78 > then temp.ch[0] = 78 //! Little end first for little endian > > and temp.ch[0] = 0x12 for big endian > > > > On Jun 13, 9:18 pm, jalaj jaiswal <[email protected]> wrote: > > hey i too have a doubt... and its just 1 ... i'll not ask c/c++ again,,, > > > > we have a union a{ > > int i; > > char ch[4]; > > } > > int here is of 4 bytes. > > i initialise i=512... > > what value will ch[0] get the upper 8 bits or the lower 8 bits... is it > big > > endian or little endian dependent... please explain this ?? > > > > On Sun, Jun 13, 2010 at 9:43 PM, Rohit Saraf < > [email protected]>wrote: > > > > > > > > > I agree mass bombarding with such questions is not very good.. but one > > > doesn't join groups and all for getting a few doubts cleared. > > > Anyways, i have no problem with anything. :D > > > > > -------------------------------------------------- > > > Rohit Saraf > > > Second Year Undergraduate, > > > Dept. of Computer Science and Engineering > > > IIT Bombay > > >http://www.cse.iitb.ac.in/~rohitfeb14<http://www.cse.iitb.ac.in/%7Erohitfeb14> > <http://www.cse.iitb.ac.in/%7Erohitfeb14> > > > > > On Sun, Jun 13, 2010 at 9:26 PM, souravsain <[email protected]> > wrote: > > > > >> and @rohit you will get better insight into the topic by more expert > > >> people by posting the question in right forum. I guess thats a win-win > > >> situation for one who has the question as he is get to know more and > > >> for people you are interested in going through C++ questions as they > > >> will read views from many more experts :) > > > > >> On Jun 13, 7:31 pm, Rohit Saraf <[email protected]> wrote: > > >> > @Souravsain : Is there any serious problem in this. Anyone can just > add > > >> a > > >> > [C++] in the subject and uninterested people can make filters in > gmail > > >> :) > > > > >> > -------------------------------------------------- > > >> > Rohit Saraf > > >> > Second Year Undergraduate, > > >> > Dept. of Computer Science and Engineering > > >> > IIT > > >> > Bombayhttp://www.cse.iitb.ac.in/~rohitfeb14<http://www.cse.iitb.ac.in/%7Erohitfeb14> > <http://www.cse.iitb.ac.in/%7Erohitfeb14> > > > > >> > On Sun, Jun 13, 2010 at 6:35 PM, souravsain <[email protected]> > > >> wrote: > > >> > > @divya > > > > >> > > Lets keep discussions in t his group limited to Algos and problems > > >> > > neutral to any language. > > > > >> > > Request you to post these C++ / C language specific questions to > those > > >> > > language specific groups. This will not only help this group > remain > > >> > > confined to its core purpose but will help you get better insights > to > > >> > > ur problem by language specific geeks there. For C++ I would > recommend > > >> > > you to try the group > > >> > > > http://groups.google.co.in/group/comp.lang.c++.moderated/topics?hl=en. > > > > >> > > Regards, > > >> > > Sourav > > > > >> > > On Jun 13, 2:29 pm, divya <[email protected]> wrote: > > >> > > > tell the o/p of following with explanations > > > > >> > > > 1. #include<stdio.h> > > >> > > > int main() > > >> > > > { > > >> > > > struct value > > >> > > > { > > >> > > > int bit1:1; > > >> > > > int bit3:4; > > >> > > > int bit4:4; > > > > >> > > > }bit; > > > > >> > > > printf("%d\n",sizeof(bit)); > > >> > > > return 0; > > > > >> > > > } > > > > >> > > > 2. > > >> > > > #include<stdio.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); > > >> > > > return 0; > > > > >> > > > } > > > > >> > > > 3 can bit field be used in union?? > > > > >> > > -- > > >> > > 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]<algogeeks%[email protected]> > <algogeeks%[email protected]<algogeeks%[email protected]> > > > > >> <algogeeks%2bunsubscr...@googlegroups.com> > > >> > > . > > >> > > For more options, visit this group at > > >> > >http://groups.google.com/group/algogeeks?hl=en.-Hide quoted text - > > > > >> > - Show quoted text - > > > > >> -- > > >> 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]<algogeeks%[email protected]> > <algogeeks%[email protected]<algogeeks%[email protected]> > > > > >> . > > >> For more options, visit this group at > > >>http://groups.google.com/group/algogeeks?hl=en. > > > > > -- > > > 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]<algogeeks%[email protected]> > <algogeeks%[email protected]<algogeeks%[email protected]> > > > > > . > > > For more options, visit this group at > > >http://groups.google.com/group/algogeeks?hl=en. > > > > -- > > With Regards, > > Jalaj Jaiswal > > +919026283397 > > B.TECH IT > > IIIT ALLAHABAD > > -- > 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]<algogeeks%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > -- 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.
