Hi Rajeev, Is there any documentation/link which shows this behavior?
On Wed, Jun 29, 2011 at 8:17 AM, varun pahwa <[email protected]> wrote: > Here is the attached image of code run in codeblocks. I think its compiler > dependent that structure can be print like this > printf("%f %d",2[*arr]); provided format specifiers in order of structure > elements. > > > On Tue, Jun 28, 2011 at 6:35 PM, [email protected] > <[email protected]> wrote: >> >> 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 <[email protected]> >> 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 [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. > > > > -- > Varun Pahwa > B.Tech (IT) > 7th Sem. > Indian Institute of Information Technology Allahabad. > Ph : 09793899112 ,08011820777 > Official Email :: [email protected] > Another Email :: [email protected] > > People who fail to plan are those who plan to fail. > > -- > 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. > -- Cheers Naveen Kumar -- 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.
