Its 2 2 on gcc compiler. Some compilers support overwriting of the const variables which is usually a bug if program expects the value of a variable to be constant . Usually newer compilers don't show such bugs.
On Sun, Aug 21, 2011 at 8:59 PM, Sanjay Rajpal <srn...@gmail.com> wrote: > i was also amazed to see the mystery behind 'const' keyword. > > > Sanju > :) > > > > On Sun, Aug 21, 2011 at 8:27 AM, shady <sinv...@gmail.com> wrote: > >> woh, thought provoking, it giving 2 2 when there is not const >> i think it has something to do with how 'const' modifies the behaviour of >> storage >> >> >> On Sun, Aug 21, 2011 at 8:33 PM, Kamakshii Aggarwal < >> kamakshi...@gmail.com> wrote: >> >>> But on dev c it is showing o/p as 2 2 .. >>> I too have a doubt,a similar question was asked in atrenta's written >>> paper. >>> >>> >>> On Sun, Aug 21, 2011 at 8:14 PM, Ankur Khurana <ankur.kkhur...@gmail.com >>> > wrote: >>> >>>> can somebody please explain this ? >>>> >>>> >>>> On Sun, Aug 21, 2011 at 8:08 PM, Nikhil Gupta < >>>> nikhilgupta2...@gmail.com> wrote: >>>> >>>>> http://www.ideone.com/kRaMj >>>>> >>>>> I found this in the algogeeks forum only. Can anyone explain how value >>>>> of i is still 0, but *p shows 2 although their addresses are the same. >>>>> >>>>> -- >>>>> Nikhil Gupta >>>>> >>>>> -- >>>>> 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. >>>>> >>>> >>>> >>>> >>>> -- >>>> Ankur Khurana >>>> Computer Science >>>> Netaji Subhas Institute Of Technology >>>> Delhi. >>>> >>>> -- >>>> 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. >>>> >>> >>> >>> >>> -- >>> Regards, >>> Kamakshi >>> kamakshi...@gmail.com >>> >>> -- >>> 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. >>> >> >> -- >> 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. >> > > -- > 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. > -- Regards Rajeev N B <http://www.opensourcemania.co.cc> "*Winners Don't do Different things , they do things Differently"* -- 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.