its tryin to acess arr[3] which is not defined and null....hence it is giving null and priniting default value 0.0000000.arr[2[ is only the last defined array of structure.
On Tue, Jun 28, 2011 at 12:07 PM, udit sharma <sharmaudit...@gmail.com>wrote: > I think this is also a compiler dependent program.. > Bcz if u run d code > > #include<stdio.h> > typedef struct > { > char *name; > double salary; > }job; > > main() > { > static job a={"tcs",15000.0}; > static job a={"ibm",25000.0}; > static job a={"google",35000.0}; > int x=5; > job *arr[3]={&a,&b,&c}; > printf("%s %f\t",(3)[*arr]); > } > > > it'll give u : (null) 0.000000 > This indicates tat d compiler is evaluating (3)[*arr] in (3,x>>1)[*arr] > > And if d compiler gives: google 35000.000000 as a result, means it is > evaluating (3,x>>1)[*arr] as (2)[*arr].. > Correct me if m wrong.. :) > > -- > 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.