@sagar: why doesnt it take place sequentially like 4*5*6*7??
why do the frst two increments take place like dat??

On Fri, Aug 12, 2011 at 1:19 AM, sagar pareek <sagarpar...@gmail.com> wrote:

> told u before
> in turbo c it increments all values of x
> x=3;
> c=7*7*7*7;
> c=2401
>
>
> On Fri, Aug 12, 2011 at 1:16 AM, Puneet Chawla 
> <puneetchawla...@gmail.com>wrote:
>
>> In turbo it is showing o/p 2401 again still confused...
>>
>>
>> On Fri, Aug 12, 2011 at 1:14 AM, sagar pareek <sagarpar...@gmail.com>wrote:
>>
>>> ok if we have the scenario like u stated then it will be done in gcc as
>>> :-
>>> x=3;
>>> c=5*5*(++x)*(++x);
>>> c=25*6*(++x);
>>> c=150*7;
>>> c=1050;
>>>
>>> On Fri, Aug 12, 2011 at 1:10 AM, aditi garg 
>>> <aditi.garg.6...@gmail.com>wrote:
>>>
>>>> @sagar: bt i dint understand how is it done
>>>> what if we had something like (++x)*(++x)*(++x)*(++x) thn how wud it be
>>>> evaluated in gcc?
>>>> and since it is giving diff ans on diff compilers that is wat i mean by
>>>> being undefined...
>>>>
>>>>
>>>> On Fri, Aug 12, 2011 at 1:05 AM, Puneet Chawla <
>>>> puneetchawla...@gmail.com> wrote:
>>>>
>>>>> @Aditi i thnk sagar parteek is right ...in turbo compiler it's
>>>>> incrementing and finally max of all values and multiply the value means 
>>>>> pre
>>>>> increment->evaluate->postincrement
>>>>>
>>>>>
>>>>> On Fri, Aug 12, 2011 at 1:02 AM, sagar pareek 
>>>>> <sagarpar...@gmail.com>wrote:
>>>>>
>>>>>> well its always depends on compiler to compiler
>>>>>> in turbo c it will first increment all x
>>>>>> results in
>>>>>> c=6*6*6
>>>>>> c=216
>>>>>>
>>>>>> but in gcc it will be as explained by me above
>>>>>>
>>>>>>
>>>>>> On Fri, Aug 12, 2011 at 12:56 AM, aditi garg <
>>>>>> aditi.garg.6...@gmail.com> wrote:
>>>>>>
>>>>>>> i think it wud be undefined...the value is getting modified more than
>>>>>>> once and hence violating the sequence points rule...plz corect me if im
>>>>>>> wrong...
>>>>>>>
>>>>>>>
>>>>>>> On Fri, Aug 12, 2011 at 12:48 AM, Puneet Chawla <
>>>>>>> puneetchawla...@gmail.com> wrote:
>>>>>>>
>>>>>>>> In turbo compiler it's o/p is 216 and in dev it's 150..
>>>>>>>> Help me out..
>>>>>>>>
>>>>>>>>
>>>>>>>> On Fri, Aug 12, 2011 at 12:45 AM, sagar pareek <
>>>>>>>> sagarpar...@gmail.com> wrote:
>>>>>>>>
>>>>>>>>> after expansion of macro
>>>>>>>>> it will be c=(++x)*(++x)*(++x);
>>>>>>>>>
>>>>>>>>> now it be solved as
>>>>>>>>>  c= 5*5*(++x);
>>>>>>>>> c=25*6;
>>>>>>>>> c=150
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Fri, Aug 12, 2011 at 12:38 AM, Puneet Chawla <
>>>>>>>>> puneetchawla...@gmail.com> wrote:
>>>>>>>>>
>>>>>>>>>> #define cube(x) (x)*(x)*(x)
>>>>>>>>>> main()
>>>>>>>>>> {
>>>>>>>>>>     int x=3,c;
>>>>>>>>>>     c=cube(++x);
>>>>>>>>>>     printf("%d",c);
>>>>>>>>>>
>>>>>>>>>> return 0;
>>>>>>>>>> }
>>>>>>>>>>
>>>>>>>>>> will anyone please tell me why o/p is 150.?
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> With regards
>>>>>>>>>>   ............
>>>>>>>>>> Puneet Chawla
>>>>>>>>>>
>>>>>>>>>>  --
>>>>>>>>>> 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
>>>>>>>>> SAGAR PAREEK
>>>>>>>>> COMPUTER SCIENCE AND ENGINEERING
>>>>>>>>> NIT ALLAHABAD
>>>>>>>>>
>>>>>>>>>  --
>>>>>>>>> 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.
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> With regards
>>>>>>>>   ............
>>>>>>>> Puneet Chawla
>>>>>>>> Computer Engineering Student
>>>>>>>> NIT Kurukshetra
>>>>>>>>
>>>>>>>>  --
>>>>>>>> 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.
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Aditi Garg
>>>>>>> Undergraduate Student
>>>>>>> Electronics & Communication Divison
>>>>>>> NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
>>>>>>> Sector 3, Dwarka
>>>>>>> New 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.
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> **Regards
>>>>>> SAGAR PAREEK
>>>>>> COMPUTER SCIENCE AND ENGINEERING
>>>>>> NIT ALLAHABAD
>>>>>>
>>>>>>  --
>>>>>> 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.
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> With regards
>>>>>   ............
>>>>> Puneet Chawla
>>>>> Computer Engineering Student
>>>>> NIT Kurukshetra
>>>>>
>>>>>  --
>>>>> 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.
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Aditi Garg
>>>> Undergraduate Student
>>>> Electronics & Communication Divison
>>>> NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
>>>> Sector 3, Dwarka
>>>> New 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.
>>>>
>>>
>>>
>>>
>>> --
>>> **Regards
>>> SAGAR PAREEK
>>> COMPUTER SCIENCE AND ENGINEERING
>>> NIT ALLAHABAD
>>>
>>>  --
>>> 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.
>>>
>>
>>
>>
>> --
>> With regards
>>   ............
>> Puneet Chawla
>> Computer Engineering Student
>> NIT Kurukshetra
>>
>>  --
>> 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
> SAGAR PAREEK
> COMPUTER SCIENCE AND ENGINEERING
> NIT ALLAHABAD
>
>  --
> 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.
>



-- 
Aditi Garg
Undergraduate Student
Electronics & Communication Divison
NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
Sector 3, Dwarka
New 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.

Reply via email to