lkml.org 
[lkml]   [1999]   [Mar]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 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/

\
 
 \ /
  Last update: 2005-03-22 13:51    [W:0.056 / U:0.724 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site