Re: [algogeeks] Find the output

2011-09-17 Thread logeshwari sekar
actually the code is correct line no 5 has been repeated again with type casting.thats it... both the code gives the same answer 2 5 On Fri, Sep 16, 2011 at 11:58 PM, wellwisher p9047551...@gmail.com wrote: but your programming is giving compilation error http://ideone.com/sqsNn the

[algogeeks] Find the output

2011-09-16 Thread Anup Ghatage
#includestdio.h int main() { int a[5]={1,2,3,4,5}; int *ptr=(a + 1); printf(%d %d\n,*(a+1),*(ptr-1)); return 0; } Find the output! -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

Re: [algogeeks] Find the output

2011-09-16 Thread Yogesh Yadav
a[]= {1, 2, 3, 4,5} a a a+1 a+1 a is address of whole array...so a+1 means next element after array completion. so ptr-1 will point to 5 ... On Fri, Sep 16, 2011 at 1:25 PM, Anup

Re: [algogeeks] Find the output

2011-09-16 Thread Brijesh
On Friday, 16 September 2011 13:25:38 UTC+5:30, Anup wrote: #includestdio.h int main() { int a[5]={1,2,3,4,5}; int *ptr=(a + 1); int *ptr=(int *)(a + 1); printf(%d %d\n,*(a+1),*(ptr-1)); return 0; } Find the output! Now it will print 2 5 -- You received this message

Re: [algogeeks] Find the output

2011-09-16 Thread Pradip Singh
it will print 2,5 On Fri, Sep 16, 2011 at 2:35 AM, Brijesh brijeshupadhyay...@gmail.comwrote: On Friday, 16 September 2011 13:25:38 UTC+5:30, Anup wrote: #includestdio.h int main() { int a[5]={1,2,3,4,5}; int *ptr=(a + 1); int *ptr=(int *)(a + 1); printf(%d

Re: [algogeeks] Find the output

2011-09-16 Thread Prateek Jain
Brijesh is right.until u do the type casting it will show an error On Fri, Sep 16, 2011 at 5:57 AM, Pradip Singh qnit...@gmail.com wrote: it will print 2,5 On Fri, Sep 16, 2011 at 2:35 AM, Brijesh brijeshupadhyay...@gmail.comwrote: On Friday, 16 September 2011 13:25:38 UTC+5:30,

Re: [algogeeks] Find the output

2011-09-16 Thread mohan kumar
thank to explain to this problem... On Fri, Sep 16, 2011 at 1:40 PM, Yogesh Yadav medu...@gmail.com wrote: a[]= {1, 2, 3, 4,5} a a a+1 a+1 a is address of whole array...so a+1

Re: [algogeeks] Find the output

2011-09-16 Thread Anup Ghatage
What does one mean by 'address of the whole array' ? On Fri, Sep 16, 2011 at 8:11 PM, mohan kumar mohankumar...@gmail.comwrote: thank to explain to this problem... On Fri, Sep 16, 2011 at 1:40 PM, Yogesh Yadav medu...@gmail.com wrote: a[]= {1, 2, 3, 4,5}

Re: [algogeeks] Find the output

2011-09-16 Thread wellwisher
but your programming is giving compilation error http://ideone.com/sqsNn the first one is giving output 2 and 5 -- 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

[algogeeks] find the output

2009-01-05 Thread tania hamid
Plz indicate the output of the following code and explain why is it so.. *char *modify (char *s) { #define MAX 15 char buffer[MAX]; strcpy (buffer, s); buffer[0] = 'H'; return buffer; } int main () { printf (hello!!!); printf (%s , modify (hello!!!)); }*