remember in C , the false statement cannot be used for assignment, if u write it without braces.It is allowed in C++ but not in C In C compiler would treat it as what aditya has explained.hence the error.
On Mon, Jul 11, 2011 at 12:59 PM, aditya pratap <[email protected] > wrote: > this is something like this thats why it is giving lvalue required. > u r going to store the the value over value which is not a variable at left > hand side. > > > main(){int a=10,b; > (a>=5?b=10:b)=20;printf > <http://www.opengroup.org/onlinepubs/009695399/functions/printf.html>("%d\n",b);} > > > > On Mon, Jul 11, 2011 at 12:47 PM, geek forgeek <[email protected]>wrote: > >> #include<stdio.h> >> main(){int a=10,b; >> a>=5?b=10:b=20;printf >> <http://www.opengroup.org/onlinepubs/009695399/functions/printf.html>("%d\n",b);} >> >> y this is asking for lvalue >> while this(below) not? >> >> >> #include<stdio.h> >> main(){int a=10,b; >> a>=5?b=10:(b=20);printf >> <http://www.opengroup.org/onlinepubs/009695399/functions/printf.html>("%d\n",b);} >> >> >> -- >> 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 > Aditya Pratap > MCA II > > -- > 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. > -- best wishes!! Vaibhav Shukla DU-MCA -- 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.
