int i=5; i=++i/i++; print i;
i=1 coz ++ operator in c has preference from right to left, therefor first (i++ is ca;cu;ated) i=5 is used then it's incremented ie i=6 now. Now at this point of time ++i is calculated, which makes i=7; finally / operator is performed and i=7/5 is calculated, which makes i=1. Similarly, int b=a++*a--; can be calculated using the preference rule. On Mon, Jul 9, 2012 at 12:16 PM, rahul sharma <rahul23111...@gmail.com>wrote: > what about post increment?????? > > > On Sun, Jul 8, 2012 at 10:37 PM, mitaksh gupta <mitak...@gmail.com> wrote: > >> the o/p will be 2 not 1 because of the post-increment operator. >> >> On Sun, Jul 8, 2012 at 10:23 PM, rahul sharma <rahul23111...@gmail.com>wrote: >> >>> int i=5; >>> i=++i/i++; >>> print i; >>> >>> >>> i=1 >>> >>> how? >>> -- >>> 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. > -- Firoz Khursheed Computer Science & Engineering -- 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.