Please see this. http://ideone.com/ZM74d <http://ideone.com/ZM74d>I tried to print by directly giving 2[*arr] still it's giving null and 0.000. Can anyone think of a possible reason?
On Fri, Jun 24, 2011 at 8:27 PM, rajeev bharshetty <[email protected]>wrote: > @ 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 <[email protected]> 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 <[email protected]> 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 <[email protected] >> >wrote: >> > >> > >> > >> > >> > >> > >> > >> > > even I am getting output as google 0.00000 >> > >> > > On 6/23/11, Bhavesh agrawal <[email protected]> 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 [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. >> > >> > > -- >> > > *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 [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. >> >> -- >> 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. >> >> > -- > 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. > -- 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.
