@ T3rminal That is because the term is resolved as 2[*arr] which is pointing to the structure variable 'c' of type 'job' So 'n' format specifiers should be used to print n values of a structure and that to in sequence of declarations in the structure .
Hope this helps :) Regards Rajeev N B I Blog @ www.opensourcemania.co.cc On Fri, Jun 24, 2011 at 4:10 AM, T3rminal <piyush....@gmail.com> wrote: > How printf can print 2 values for %s and %f if you provided only 1 > (3,x>>1)[*arr] ? > > On Jun 24, 12:13 am, Anika Jain <anika.jai...@gmail.com> wrote: > > #include<stdio.h> > > typedef struct > > { > > char *name; > > double salary;}job; > > > > main() > > { > > static job a={"tcs",15000.0}; > > static job b={"ibm",25000.0}; > > static job c={"google",35000.0}; > > int x=5; > > job *arr[3]={&a,&b,&c}; > > printf("%s %f\t",(3,x>>1)[*arr]); > > > > } > > > > it is giving google 35000.000000 there's no error.. i think u r doing > some > > mistake by not writing %s as format specifier in printing.. > > On Thu, Jun 23, 2011 at 8:20 AM, Piyush Sinha <ecstasy.piy...@gmail.com > >wrote: > > > > > > > > > > > > > > > > > even I am getting output as google 0.00000 > > > > > On 6/23/11, Bhavesh agrawal <agr.bhav...@gmail.com> wrote: > > > > i got (null) 0.00000 on my gcc compiler , is there any syntax error > > > > > > -- > > > > 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. > > > > > -- > > > *Piyush Sinha* > > > *IIIT, Allahabad* > > > *+91-8792136657* > > > *+91-7483122727* > > > *https://www.facebook.com/profile.php?id=100000655377926* > > > > > -- > > > 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.