ch=i++[s]; // in this value is assigned first and then increment will take place...bcozz you are using post increment. here i does not have any other option it has to do post increment before [] comes...but it will not assign value to 'i' ( i.e incremented 'i' value) so compiler will do something like this ch=*(i + s); i=i+1;
ch=++i[s]; // in this case compiler will rewrite it to something like this , ch=++(*(i+s)); // this will increment the value at i[s], pre-increment is taking place ...so updated i[s] value will be assigned o ch if you do somthing like this :- ch=i[s]++; // here post increment is happening , so compiler will rewrite it somthing like this // ch will contain old value but if you print i[s] , it will print incremented value of i[s]; ch=*(i+s); i[s]=i[s] + 1; On 10/6/12, rahul sharma <rahul23111...@gmail.com> wrote: > char ch > ch=i++[s]; > > printf("%c",ch); this will print i[s],then i is incrementrd after > assigning to ch.... > > > ch=++i[s];// this will inccrement value at i[s] > > > My question is what is role of priority which is making them behaving > different,,,,I am not getting y not first i is incremented then i[s] is > assigned.... > plz tell > > -- > 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.