Re: A bit off-topic ... (fwd)

Rivalino Matias Junior (rivalino@unoesc.rct-sc.br)
Thu, 1 Apr 1999 11:12:37 -0400 (AST)


On Wed, 31 Mar 1999, Q wrote:

> Rivalino Matias Junior wrote:
> >
> > PS: Reply with Cc: rivalino@unoesc.rct-sc.br, because i don't receive
> > this list.
> >
> > ---------- Forwarded message ----------
> > Date: Wed, 31 Mar 1999 14:49:13 -0400 (AST)
> > From: Rivalino Matias Junior <rivalino@unoesc.rct-sc.br>
> > To: linux-c-programming@vger.rutgers.edu
> > Subject: Re: A bit off-topic ...
> >
> > Hello All,
> >
> > I'm have a problem:
> >
> > #include <stdio.h>
> >
> > void main()
> > {
> > int x=0;
> > int y=1;
> >
> > x= (y)?x=1:x=2;
> > }
> >
> > The result of x is two. Why ?
> >
>
> You should do: x = y ? 1 : 2;
>
> when trying to compile it, I get:
>
> invalid lvalue in assignment

Try with g++.
>
> with all compilers I tried.
>
>
> Q
>

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/