|
|
On Mar 30, 7:19 am, Richard Heathfield <r...@xxxxxxxxxxxxxxx> wrote:
> Rahul said:
>
> > Hi Everyone,
>
> > I have the following piece of code, and i expected an error, however
> > i don't get an error,
>
> > int main()
> > {
> > int aa=0,b=0;
> > 1>0?aa:b = 10;
>
> This is a syntax error (which therefore requires the implementation to
> diagnose it as such). The syntax of the conditional operator is:
>
I believe the syntax is legal. It just doesn't do what the OP wanted
it to.
Consider that it parses as
(1>0)?(aa):(b=10);
Change it to 1<0?aa:b=10; and see the result...
Regards,
-=Dave
|
|