for the 1st printf i hv this explanation: precedence of ++ is greater then * ... but associativity of both of them is right to left... thats why dereferenced takes place 1st and then the pointer is incremented...
rest is fine... correct me if i m wrong... On Aug 22, 3:47 pm, aditi garg <aditi.garg.6...@gmail.com> wrote: > in frst printf we acess *s and s is incremented later...so it prints A bt at > the same time s points to B now... > In 2nd printf s is incremented frst and thn dereferencd...after incrementing > it points to C and whn we dereference it we get C > in the third printf *s=C whn we increment this we get D > so the ans wud be ACD... > I hope its clear > > > > > > > > > > On Mon, Aug 22, 2011 at 4:03 PM, MANNU <manishkr2...@gmail.com> wrote: > > main() > > { > > char ch[]="ABCD"; > > char *s; > > s=ch; > > printf("%c",*s++); > > printf("%c",*++s); > > printf("%c",++*s); > > } > > > Can anyone plz tell me the concept behind output?? > > > -- > > 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. > > -- > Aditi Garg > Undergraduate Student > Electronics & Communication Divison > NETAJI SUBHAS INSTITUTE OF TECHNOLOGY > Sector 3, Dwarka > New 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.