@nicks -- ur code for 1st problem is giving me 1 not -1 on gcc..which
compiler are you using

On Fri, Jul 22, 2011 at 11:58 AM, sumit <sumitispar...@gmail.com> wrote:

> +1 to t3rminal
>
>
> On Jun 12, 11:38 pm, T3rminal <piyush....@gmail.com> wrote:
> > @all
> > Stop guessing and making your own standards. C standards haven't
> > defined anything (though in gcc arguments are processed from left to
> > right) about processing arguments in a function call. And sentence
> > like "assgnment to a preincrement expression is delayed vry mch...."
> > have no meaning . Seriously which book have you referred.
> > This all fall in category of UNDEFINED BEHAVIOR.
> > If a value of a variable is changed more than once between two
> > sequence points, it give rises to side-effect which lead to undefined
> > behavior.
> > There is no explanation for this output supported by C standards.
> > On Jun 12, 8:14 pm, varun pahwa <varunpahwa2...@gmail.com> wrote:
> >
> >
> >
> >
> >
> >
> >
> > > yes the output is compiler dependent.
> >
> > > On Sun, Jun 12, 2011 at 6:35 AM, nicks <crazy.logic.k...@gmail.com>
> wrote:
> > > > but program by anika is giving *7 6 8* on gcc.....but *7 6 6 *on
> > > > dev-cpp...........i am wondering if the output is compiler dependent
> !!
> >
> > > > On Sun, Jun 12, 2011 at 6:33 AM, nicks <crazy.logic.k...@gmail.com>
> wrote:
> >
> > > >> no it's
> > > >> a=1 b=1
> > > >> i=2
> >
> > > >> i ran it on gcc (linux ubuntu 11.04)
> >
> > > >> On Sun, Jun 12, 2011 at 6:26 AM, sanjay ahuja <
> sanjayahuja.i...@gmail.com
> > > >> > wrote:
> >
> > > >>> with GCC the above code gives a = 1 and b = 2
> >
> > > >>> On Sun, Jun 12, 2011 at 6:39 PM, nicks <crazy.logic.k...@gmail.com
> >
> > > >>> wrote:
> > > >>> > @himanshu....what abt this ??
> >
> > > >>> > #include<stdio.H>
> > > >>> > # include <conio.h>
> > > >>> > int i=2;
> > > >>> > main()
> > > >>> > {
> > > >>> >  void add();
> > > >>> >  add(i++,--i);
> > > >>> >     printf("\ni=%d \n",i);system("pause");
> > > >>> > }
> > > >>> > void add(int a ,int b)
> > > >>> > {
> > > >>> >  printf("\na=%d b=%d",a,b);
> > > >>> > }
> >
> > > >>> >  OUTPUT -
> > > >>> > a=1 b=1
> > > >>> > i=2
> >
> > > >>> > acc. to ur logic output should be -
> > > >>> > a=1 b=2
> > > >>> > i=2
> >
> > > >>> > On Sun, Jun 12, 2011 at 5:42 AM, Anika Jain <
> anika.jai...@gmail.com>
> > > >>> wrote:
> >
> > > >>> >> thanks himanshu finally i got the reason!!
> > > >>> >> :)
> >
> > > >>> >> On Sun, Jun 12, 2011 at 5:59 PM, himanshu kansal
> > > >>> >> <himanshukansal...@gmail.com> wrote:
> >
> > > >>> >>> @anika:cz on gcc arguemnts r eval frm right to left and
> assgnment to
> > > >>> a
> > > >>> >>> pre increment expression is delayed vry mch....
> > > >>> >>> so on eval frm right to left....
> > > >>> >>> frst a is incremented...(6) bt remember d new value is nt
> pushed on
> > > >>> stack
> > > >>> >>> till nw....(cz assgnmnt is delayed)
> > > >>> >>> thn next value is 6...nd thn a is incremented.....here being a
> post
> > > >>> >>> increment op....assgnmnt is made 1st (2nd arg to fun is 6)and a
> is
> > > >>> >>> incrementd to 7....
> > > >>> >>> simalrly.....assgnmnt is made(1st arg is 7) and a is incremnted
> to
> > > >>> 8.....
> > > >>> >>> nw d assgnmnt is made to the 3rd arg(d assgnmnt whch ws delayed
> till
> > > >>> >>> nw).....hence 3rd arg becomes 8.....
> > > >>> >>> so it prints 7 6 8......
> >
> > > >>> >>> On Sun, Jun 12, 2011 at 5:33 PM, Anika Jain <
> anika.jai...@gmail.com>
> > > >>> >>> wrote:
> >
> > > >>> >>>> can anybody explain that in following code y output is coming
> to be:
> > > >>> 7 6
> > > >>> >>>> 8
> >
> > > >>> >>>> void call(int a,int b,int c)
> > > >>> >>>> {
> > > >>> >>>>          printf("%d %d %d",a,b,c);
> > > >>> >>>> }
> >
> > > >>> >>>> int main()
> > > >>> >>>> {
> > > >>> >>>> int a=5;
> > > >>> >>>> call(a++,a++,++a);
> > > >>> >>>> return 0;
> > > >>> >>>> }
> >
> > > >>> >>>> On Sat, Jun 11, 2011 at 8:21 PM, PRAMENDRA RATHi rathi
> > > >>> >>>> <prathi...@gmail.com> wrote:
> >
> > > >>> >>>>> IN second program:
> > > >>> >>>>>  in function value are always push in the stack from right.
> > > >>> >>>>> so first value is --i that will make i=1 and value 1 will be
> passed
> > > >>> to
> > > >>> >>>>> function
> > > >>> >>>>> and
> > > >>> >>>>> after that i++ that's means i will be passed.
> > > >>> >>>>> so 1 will be passed and after passing value. i will changed
> to 2.
> >
> > > >>> >>>>> if u want to know why reverse order than can go through:
> >
> > > >>> >>>>>http://cs.nyu.edu/courses/fall03/V22.0201-003/c_param.html
> > > >>> >>>>> -----------------------------------------
> > > >>> >>>>> PRAMENDRA RATHI
> > > >>> >>>>> NIT ALLAHABAD
> >
> > > >>> >>>>> On Sat, Jun 11, 2011 at 7:28 PM, Vishal Thanki <
> > > >>> vishaltha...@gmail.com>
> > > >>> >>>>> wrote:
> >
> > > >>> >>>>>> In 1st program, 2nd printf requires one more argument. And
> > > >>> basically
> > > >>> >>>>>> %a is used for printing a double value in hex. see "man 3
> printf".
> >
> > > >>> >>>>>> On Sat, Jun 11, 2011 at 5:29 PM, nicks <
> > > >>> crazy.logic.k...@gmail.com>
> > > >>> >>>>>> wrote:
> > > >>> >>>>>> > Hello friends..plz help me in understanding the following
> C
> > > >>> Output
> >
> > > >>> >>>>>> > first one is --
> >
> > > >>> >>>>>> > #include<stdio.h>
> > > >>> >>>>>> > #include<conio.h>
> > > >>> >>>>>> > main()
> > > >>> >>>>>> > {
> > > >>> >>>>>> > int a=5;
> > > >>> >>>>>> > printf("a=%d\n",a);
> > > >>> >>>>>> > printf("%a=%d",a);
> > > >>> >>>>>> > getch();
> > > >>> >>>>>> > }
> > > >>> >>>>>> > OUTPUT -
> > > >>> >>>>>> > a=5
> > > >>> >>>>>> > 0x1.2ff380p-1021=4199082
> >
> > > >>> >>>>>> > and the other one is --
> >
> > > >>> >>>>>> > #include<stdio.H>
> > > >>> >>>>>> > # include <conio.h>
> > > >>> >>>>>> > int i=2;
> > > >>> >>>>>> > main()
> > > >>> >>>>>> > {
> > > >>> >>>>>> >  void add();
> > > >>> >>>>>> >  add(i++,--i);
> > > >>> >>>>>> >     printf("\ni=%d \n",i);system("pause");
> > > >>> >>>>>> > }
> > > >>> >>>>>> > void add(int a ,int b)
> > > >>> >>>>>> > {
> > > >>> >>>>>> >  printf("\na=%d b=%d",a,b);
> > > >>> >>>>>> > }
> >
> > > >>> >>>>>> >  OUTPUT -
> > > >>> >>>>>> > a=1 b=1
> > > >>> >>>>>> > i=2
> >
> > > >>> >>>>>> > --
> > > >>> >>>>>> > 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.
> >
> > > >>> >> --
> > > >>> >> 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.
> >
> > > >>> --
> > > >>> Sanjay Ahuja,
> > > >>> Analyst, Financing Prime Brokerage
> > > >>> Nomura Securities India Pvt. Ltd
> >
> > > >>> --
> > > >>> 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.
>
>

-- 
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.

Reply via email to