Sorry. Ignore the last message of mine. It does not belong to this thread. :)
On Fri, Jun 24, 2011 at 8:37 PM, oppilas . <[email protected]>wrote: > 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 12:55 AM, richa mahajan <[email protected]>wrote: > >> i think it ll be compiler dependent becoz comma acts as a sequence pooint >> but not in function calls so semi colon here is a sequnce point and d value >> of an object (ptr here) is being modified more than once (between two seq >> points ) so this is undefined behavior..output will b compiler dependent >> >> >> On Wed, Jun 22, 2011 at 5:55 PM, udit sharma <[email protected]>wrote: >> >>> #include<stdio.h> >>> int main() >>> { >>> void print(int *,int *,int *,int *,int *); >>> static int arr[]={97,98,99,100,101,102,103,104}; >>> int *ptr=arr+1; >>> print(++ptr,ptr--,ptr,ptr++,++ptr); >>> return 0; >>> } >>> void print(int *a,int *b,int *c,int *d,int *e) >>> { >>> printf("%d\t%d\t%d\t%d\t%d\n",*a,*b,*c,*d,*e); >>> } >>> >>> Why the output is: >>> 100 100 100 99 100 >>> >>> >>> -- >>> Regards >>> UDIT >>> DU- MCA >>> >>> -- >>> 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.
