Re: [algogeeks] Re: c query
Hi Rajeev, Is there any documentation/link which shows this behavior? On Wed, Jun 29, 2011 at 8:17 AM, varun pahwa varunpahwa2...@gmail.com 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, sameer.mut...@gmail.com sameer.mut...@gmail.com wrote: its tryin to acess arr[3] which is not defined and nullhence it is giving null and priniting default value 0.000.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 #includestdio.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.00 This indicates tat d compiler is evaluating (3)[*arr] in (3,x1)[*arr] And if d compiler gives: google 35000.00 as a result, means it is evaluating (3,x1)[*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. -- Varun Pahwa B.Tech (IT) 7th Sem. Indian Institute of Information Technology Allahabad. Ph : 09793899112 ,08011820777 Official Email :: rit2008...@iiita.ac.in Another Email :: varunpahwa.ii...@gmail.com 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 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. -- 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 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.
Re: [algogeeks] Re: c query
I think this is also a compiler dependent program.. Bcz if u run d code #includestdio.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.00 This indicates tat d compiler is evaluating (3)[*arr] in (3,x1)[*arr] And if d compiler gives: google 35000.00 as a result, means it is evaluating (3,x1)[*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.
Re: [algogeeks] Re: c query
can nyone xplain me dt whats d meaning of (null) in d output...cz m getting (null) 0.0 for d abv ques On Fri, Jun 24, 2011 at 8:41 PM, oppilas . jatka.oppimi...@gmail.comwrote: Please see this. http://ideone.com/ZM74d http://ideone.com/ZM74dI 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 rajeevr...@gmail.comwrote: @ 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,x1)[*arr] ? On Jun 24, 12:13 am, Anika Jain anika.jai...@gmail.com wrote: #includestdio.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,x1)[*arr]); } it is giving google 35000.00 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.comwrote: even I am getting output as google 0.0 On 6/23/11, Bhavesh agrawal agr.bhav...@gmail.com wrote: i got (null) 0.0 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=10655377926* -- 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. -- 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. -- Regards Himanshu Kansal Msc Comp. sc. (University of Delhi) -- 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.
Re: [algogeeks] Re: c query
its tryin to acess arr[3] which is not defined and nullhence it is giving null and priniting default value 0.000.arr[2[ is only the last defined array of structure. On Tue, Jun 28, 2011 at 12:07 PM, udit sharma sharmaudit...@gmail.comwrote: I think this is also a compiler dependent program.. Bcz if u run d code #includestdio.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.00 This indicates tat d compiler is evaluating (3)[*arr] in (3,x1)[*arr] And if d compiler gives: google 35000.00 as a result, means it is evaluating (3,x1)[*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.
Re: [algogeeks] Re: c query
@ 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,x1)[*arr] ? On Jun 24, 12:13 am, Anika Jain anika.jai...@gmail.com wrote: #includestdio.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,x1)[*arr]); } it is giving google 35000.00 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.0 On 6/23/11, Bhavesh agrawal agr.bhav...@gmail.com wrote: i got (null) 0.0 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=10655377926* -- 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.
Re: [algogeeks] Re: c query
Please see this. http://ideone.com/ZM74d http://ideone.com/ZM74dI 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 rajeevr...@gmail.comwrote: @ 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,x1)[*arr] ? On Jun 24, 12:13 am, Anika Jain anika.jai...@gmail.com wrote: #includestdio.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,x1)[*arr]); } it is giving google 35000.00 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.0 On 6/23/11, Bhavesh agrawal agr.bhav...@gmail.com wrote: i got (null) 0.0 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=10655377926* -- 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. -- 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.
[algogeeks] Re: c query
How printf can print 2 values for %s and %f if you provided only 1 (3,x1)[*arr] ? On Jun 24, 12:13 am, Anika Jain anika.jai...@gmail.com wrote: #includestdio.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,x1)[*arr]); } it is giving google 35000.00 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.comwrote: even I am getting output as google 0.0 On 6/23/11, Bhavesh agrawal agr.bhav...@gmail.com wrote: i got (null) 0.0 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=10655377926* -- 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.