Re: [algogeeks] find output

2011-07-05 Thread sagar pareek
this will help you try the following :- *p++ (*p)++ *(p++) ++*p *++p all your confusions will flushed out :) On Mon, Jul 4, 2011 at 1:25 PM, Deoki Nandan wrote: > when u use post increment operator in an expression and there is sequence > point like || or && then value of post increment counted

Re: [algogeeks] find output

2011-07-04 Thread amit kumar
thanx guys... On Mon, Jul 4, 2011 at 5:11 PM, mahesh.jnumc...@gmail.com < mahesh.jnumc...@gmail.com> wrote: > In while loop, the value of i will be used as 0 as it is post decrement so > the value of i will decrement after the while loop is executed. > so 0!=0 will fail and the value of i will g

Re: [algogeeks] find output

2011-07-04 Thread mahesh.jnumc...@gmail.com
In while loop, the value of i will be used as 0 as it is post decrement so the value of i will decrement after the while loop is executed. so 0!=0 will fail and the value of i will get decrement and will be printed as -1. On Mon, Jul 4, 2011 at 3:54 PM, amit the cool wrote: > main() > { > int i=0

Re: [algogeeks] find output

2011-07-04 Thread Anika Jain
in this actually whats happening is : int i=0; while((i--)!=0) i-=i++; printf("%d\n",i); here when i is compared to 0 i is 0 and then it is decremented to -1, while loop never gets executed. On Mon, Jul 4, 2011 at 3:54 PM, amit the cool wrote: > main() > { > int i=0; > while(+(+i--)!=0) > i-

Re: [algogeeks] find output

2011-07-04 Thread oppilas .
On Mon, Jul 4, 2011 at 3:54 PM, amit the cool wrote: > main() > { > int i=0; > while(+(+i--)!=0) > Here the value passed of i is 0 only. So the next statement does not execute. But after using, I gets decremented to -1 > i-=i++; > printf("%d",i); > } > > output sud be 1 > bt it is -1; > why?? > >

[algogeeks] find output

2011-07-04 Thread amit the cool
main() { int i=0; while(+(+i--)!=0) i-=i++; printf("%d",i); } output sud be 1 bt it is -1; why?? -- 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,

Re: [algogeeks] find output

2011-07-04 Thread Deoki Nandan
when u use post increment operator in an expression and there is sequence point like || or && then value of post increment counted in expression other wise not On Mon, Jul 4, 2011 at 11:24 AM, Navneet Gupta wrote: > I think one rule of thumb for reading pre and post increment operators is > > 1)

Re: [algogeeks] find output

2011-07-03 Thread Navneet Gupta
I think one rule of thumb for reading pre and post increment operators is 1) For Pre - Increment the value and use it (++x) 2) For Post - Use the value and increment it (x++) Similar is for pre and post decrement. I am not very good at commenting the generality of above but in simple usages like

Re: [algogeeks] find output

2011-07-03 Thread Anantha Krishnan
y=*x++; this line executes like this: y=*x; x=x+1; // post increment Regards Anantha Krishnan On Mon, Jul 4, 2011 at 10:36 AM, amit kumar wrote: > i think d answer sud be 10. > but it comes out to be 5. > xplain plz > > > On Mon, Jul 4, 2011 at 10:30 AM, Sandeep Jain wrote: > >> Apoorve, pleas

Re: [algogeeks] find output

2011-07-03 Thread amit kumar
i think d answer sud be 10. but it comes out to be 5. xplain plz On Mon, Jul 4, 2011 at 10:30 AM, Sandeep Jain wrote: > Apoorve, please explain the reason for this output as well > > > Regards, > Sandeep Jain > > > > > > On Mon, Jul 4, 2011 at 1:06 AM, Apoorve Mohan wrote: > >> 5 >> >> >> On Mon

Re: [algogeeks] find output

2011-07-03 Thread Sandeep Jain
Apoorve, please explain the reason for this output as well Regards, Sandeep Jain On Mon, Jul 4, 2011 at 1:06 AM, Apoorve Mohan wrote: > 5 > > > On Mon, Jul 4, 2011 at 1:01 AM, amit the cool wrote: > >> int main() >> { >>int a[]={5,10,15,8}; >>int *x=a; >>int y; >>

Re: [algogeeks] find output

2011-07-03 Thread Apoorve Mohan
5 On Mon, Jul 4, 2011 at 1:01 AM, amit the cool wrote: > int main() > { >int a[]={5,10,15,8}; >int *x=a; >int y; >y=*x++; >printf("%d",y); > } > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To

[algogeeks] find output

2011-07-03 Thread amit the cool
int main() { int a[]={5,10,15,8}; int *x=a; int y; y=*x++; printf("%d",y); } -- 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 unsubscri

[algogeeks] find output.

2011-06-15 Thread amit the cool
main() { char *p="hai friends",*p1; p1=p; while(*p!='\0') ++*p++; printf("%s %s",p,p1); } -- 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 em