same as:
int a[5] = { 1, 2, 3, 4, 5 };
int i = 3;
printf("%d", i[a]);in question asked, &a will set ptr to 3rd position ie. at H and will print whole string &b will set ptr to 5th position ie. @ s it also print whole string. But in 2nd printf , string will start from 3rd position ie. T and will replace all %c with index which is outside of square bracket from the string inside square bracket. On Thu, Jun 2, 2011 at 11:45 PM, shashankreddy509 < [email protected]> wrote: > Can any one explain the output of this... > > i have a guess. > > int a=3, b = 5; printf(&a["Ya!Hello! how is this? %s\n"], > &b["junk/super"]); > > here a is 3 so it print the after 3 characters ie."*Hello! how is this?* > ". > and coming to b is 5 so it prints "*super*". > > this is my guess and i cant get the other part this. > > so can any one tell the correct answer.. > > thanks. > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/algogeeks/-/clNhSWJBaEJEZllK. > > 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. > -- Harshal Choudhary, III Year B.Tech CSE, NIT Surathkal, Karnataka, India. -- 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.
