@rajkumar: thanks #include <stdio.h>
#define max(a,b) ((a>b)?a:b) int main() { int m,n; m=3+max(2,3); n=2*max(3,2); printf("%d,%d",m,n); getchar(); return 0; } this gives the correct output as 6,6 On Mon, Aug 8, 2011 at 7:12 PM, Dipankar Patro <dip10c...@gmail.com> wrote: > relational operators give 0/1 output; > (a>b) - will be either 0 or 1. > similarly (a==b) will either be 0 or 1 > > > On 8 August 2011 18:39, Anil Arya <anilarya...@gmail.com> wrote: > >> in expression (a>b)?a:b----------->(a>b) returns 1 if true and 0 if >> (false) . >> >> >> >> On Mon, Aug 8, 2011 at 6:08 PM, dilip makwana <dilipmakwa...@gmail.com>wrote: >> >>> Since test condition will always evaluate to non-zero value (which is >>> considered true in c/c++) hence always first option get selected .... >>> >>> >>> On 8 August 2011 17:44, Shachindra A C <sachindr...@gmail.com> wrote: >>> >>>> oops...I'm sorry.. the statement would evaluate to 3 + *0* ? 2 : 3 ==> >>>> *3* ? 2 : 3 ==> m = 2. >>>> >>>> >>>> On Mon, Aug 8, 2011 at 5:43 PM, Shachindra A C >>>> <sachindr...@gmail.com>wrote: >>>> >>>>> @raj, >>>>> the preprocessed file would contain m=3+(2>3)?2:3 AFAIK. >>>>> >>>>> So, the statement would evaluate to 3 + 1 ? 2 : 3 ==> 4 ? 2 : >>>>> 3 ==> m = 2. >>>>> >>>>> Likewise for n. >>>>> >>>>> >>>>> On Mon, Aug 8, 2011 at 5:21 PM, raj kumar <megamonste...@gmail.com>wrote: >>>>> >>>>>> 3+2>3?2:3 >>>>>> so 5>3 hence 2 is returned bcoz of higher precedence of + over ? >>>>>> Thanks >>>>>> >>>>>> -- >>>>>> 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, >>>>> Shachindra A C >>>>> >>>>> >>>> >>>> >>>> -- >>>> Regards, >>>> Shachindra A 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. >>>> >>> >>> >>> >>> -- >>> *Dilip Makwana* >>> VJTI >>> BTech Computers Engineering >>> 2009-2013 >>> >>> -- >>> 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. >>> >> >> >> >> -- >> Anil Kumar Arya >> B.Tech III year >> computer science & engineering >> M.N.N.I.T 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. >> > > > > -- > > ___________________________________________________________________________________________________________ > > Please do not print this e-mail until urgent requirement. Go Green!! > Save Papers <=> Save Trees > > -- > 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.