but gcc compiler is giving error saying- can't convert int* to char* in assignment......so hw r u getting 566 as answer?? ( I am using codeblocks on ubuntu )
On Mon, Feb 7, 2011 at 10:10 PM, jalaj jaiswal <[email protected]>wrote: > @ dave .. you r correct :) > > > On Mon, Feb 7, 2011 at 9:41 PM, Dave <[email protected]> wrote: > >> @Jalaj: The results depend on the "endianness" of the addressing >> scheme on your hardware. (See http://en.wikipedia.org/wiki/Endianness.) >> The language standard does not specify a required endianness. You must >> be using a little-endian hardware, but the results would be different >> on a big-endian system. >> >> Dave >> >> On Feb 6, 11:03 am, jalaj jaiswal <[email protected]> wrote: >> > the logic is :- >> > int is stored in 32 bits in our systems >> > >> > 300 is 00000000 00000000 00000001 00101100 >> > as ptr is character pointer, it points to lower 8 bits >> > and when *++ptr=2 gets executed then 00000001 changes to 00000010(equal >> to >> > 2) >> > >> > so i becomes 00000000 00000000 00000010 00101100 which is 556 :D >> > >> > On Sun, Feb 6, 2011 at 10:26 PM, aditya pratap >> > <[email protected]>wrote: >> > >> > > @jalaj : gcc compiler. >> > >> > > -- >> > > 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. >> > >> > -- >> > With Regards, >> > *Jalaj Jaiswal* (+919019947895) >> > Final Year Undergraduate, >> > 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]. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> >> > > > -- > With Regards, > *Jalaj Jaiswal* (+919019947895) > Software developer, Cisco Systems > > Final Year Undergraduate, > 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]. > 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.
