[algogeeks] c programming question
*#includestdio.h void main(void) { int a=10,b; b=a++ + ++a; printf(%d,%d,%d,%d,b,a++,a,++a); } *what is the answer?how are the function parameters passed on the stack? -- 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.
Re: [algogeeks] c programming question
The answer will be compiler dependent.Google Sequence Point in C. -- 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.
Re: [algogeeks] c programming question
the output is 22 13 13 as increment and decrement operators associate from right to left hence first ++a will be evluated which makes a=11 then a++ is evaluated as its a postfix operation hence b=a+a=11+11=22 and after this a =12 then in printf statement again right associativity follows hence ++a sets a=13 and the output is 22 13 13 On Sat, Feb 5, 2011 at 2:04 AM, aniket chatterjee aniket...@gmail.comwrote: The answer will be compiler dependent.Google Sequence Point in C. -- 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.comalgogeeks%2bunsubscr...@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.