There is NO universal way of doing this; every compiler does it differently, in its own ways. The problem here is that the above code changes the value of variable `i' many times between two sequence points. So you cant be sure as to what value `i' holds at what time!!!
For more insight and a better explanation see http://c-faq.com/expr/evalorder2.html To know more about the sequence points in a C program see http://c-faq.com/expr/seqpoints.html On Fri, Jul 22, 2011 at 4:07 PM, rajeev bharshetty <[email protected]>wrote: > Some more explanation taking an example will be helpful > take the example in the program. > > Thanks > > > On Fri, Jul 22, 2011 at 4:03 PM, Prem Krishna Chettri > <[email protected]>wrote: > >> Values will be Pushed to the Stack from left to right and Evaluated to be >> finally printed from the Stack. >> >> >> On Fri, Jul 22, 2011 at 4:01 PM, rShetty <[email protected]> wrote: >> >>> #include<stdio.h> >>> >>> int main() >>> { >>> >>> int i=1; >>> printf("%d%d%d%d",++i,++i,++i,i++); >>> >>> return 0; >>> >>> } >>> >>> Explain how it will be evaluated ?? and the output obtained .. >>> >>> -- >>> 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. >> > > > > -- > Regards > Rajeev N B <http://www.opensourcemania.co.cc> > > -- > 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.
