Re: [algogeeks] Re: need explanation of this c code
On Sun, Sep 4, 2011 at 9:22 PM, vivek goel vivek.thapar2...@gmail.comwrote: itz my pleasure . so u r pursuing ur engg frm where i thk its an undefined behaviour and the answer will vary from compiler to compiler. On Sun, Sep 4, 2011 at 7:33 PM, sinjanspecial sinjanspec...@gmail.comwrote: thanks vivek On Sep 3, 10:29 pm, sinjanspecial sinjanspec...@gmail.com wrote: code:- void main() { int i=5; i=(++i)/(i++); printf(%d,i)} Output is 2 plz explain how it is? -- 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.
Re: [algogeeks] Re: need explanation of this c code
It's 1 on dev c++ On Mon, Sep 5, 2011 at 1:17 PM, Nitin coolguyinat...@gmail.com wrote: On Sun, Sep 4, 2011 at 9:22 PM, vivek goel vivek.thapar2...@gmail.comwrote: itz my pleasure . so u r pursuing ur engg frm where i thk its an undefined behaviour and the answer will vary from compiler to compiler. On Sun, Sep 4, 2011 at 7:33 PM, sinjanspecial sinjanspec...@gmail.comwrote: thanks vivek On Sep 3, 10:29 pm, sinjanspecial sinjanspec...@gmail.com wrote: code:- void main() { int i=5; i=(++i)/(i++); printf(%d,i)} Output is 2 plz explain how it is? -- 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.
Re: [algogeeks] Re: need explanation of this c code
true its purely compiler dependant.. if the sequence evaluates right to left then answer is 1 else its 2...(last increment is post on i) On Mon, Sep 5, 2011 at 1:17 PM, Nitin coolguyinat...@gmail.com wrote: It's 1 on dev c++ On Mon, Sep 5, 2011 at 1:17 PM, Nitin coolguyinat...@gmail.com wrote: On Sun, Sep 4, 2011 at 9:22 PM, vivek goel vivek.thapar2...@gmail.comwrote: itz my pleasure . so u r pursuing ur engg frm where i thk its an undefined behaviour and the answer will vary from compiler to compiler. On Sun, Sep 4, 2011 at 7:33 PM, sinjanspecial sinjanspec...@gmail.comwrote: thanks vivek On Sep 3, 10:29 pm, sinjanspecial sinjanspec...@gmail.com wrote: code:- void main() { int i=5; i=(++i)/(i++); printf(%d,i)} Output is 2 plz explain how it is? -- 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.
[algogeeks] Re: need explanation of this c code
thanks vivek On Sep 3, 10:29 pm, sinjanspecial sinjanspec...@gmail.com wrote: code:- void main() { int i=5; i=(++i)/(i++); printf(%d,i)} Output is 2 plz explain how it is? -- 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.
[algogeeks] Re: need explanation of this c code
yes..you are right ..sukaran...that is depends on compiler which one we are using...6/5 or 6/6 only two possibilities come but answer will come 2 only for this qn on every compiler.. .. On Sep 4, 8:22 pm, sukran dhawan sukrandha...@gmail.com wrote: order of evaluation for such expressions is not defined in standard c.it is compiler dependent./ is not sequence point On Sat, Sep 3, 2011 at 11:05 PM, vivek goel vivek.thapar2...@gmail.comwrote: firstly ++i will be evaluated so i=6 then expression will be i=6/6; so now i will be equal to 1.. after the expression will be evaluated i++ post increment will work since, post increment works only if a semi-colon occurs or comma operator occurs. so now i will increment after this statement.. so now i will be equal to 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.
Re: [algogeeks] Re: need explanation of this c code
itz my pleasure . so u r pursuing ur engg frm where On Sun, Sep 4, 2011 at 7:33 PM, sinjanspecial sinjanspec...@gmail.comwrote: thanks vivek On Sep 3, 10:29 pm, sinjanspecial sinjanspec...@gmail.com wrote: code:- void main() { int i=5; i=(++i)/(i++); printf(%d,i)} Output is 2 plz explain how it is? -- 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.