Messages in this thread | | | Date | Wed, 31 Mar 1999 21:59:33 +0100 | From | Q <> | Subject | Re: A bit off-topic ... (fwd) |
| |
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
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/
| |