@Mohit: If u're saying that in case 2 ptr is const then what is int *const ptr. I thought this is a constant pointer. Constant pointer is one which can't be made to point to any other address rit? How is *ptr++ coming into the way of constant pointer ?
On Mon, Jun 7, 2010 at 7:59 PM, mohit ranjan <[email protected]>wrote: > @Raj, > > no they are not same > > > case 1: i is const > case 2: ptr is const > > and whatever is const cann't be modified > > Mohit Ranjan > > > On Mon, Jun 7, 2010 at 3:01 PM, Raj N <[email protected]> wrote: > >> Can someone tell me the difference between >> 1) const int i=5; 2) int i=5; >> int *ptr=&i; const int >> *ptr=&i; >> >> In the first case i can be modified via ptr i.e *ptr++ is valid. In >> the second case *ptr++ is illegal. Why is that so? Aren't they same? >> >> -- >> 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]<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.
