Path: utzoo!attcan!uunet!mcvax!unido!rwthinf!rwthbs!hls From: hls@rwthbs.UUCP (H.L. Stahl) Newsgroups: comp.lang.c Subject: Re: down Message-ID: <318@rwthbs.UUCP> Date: 12 Dec 88 11:47:32 GMT References: Reply-To: hls@rwthbs.UUCP (H.-L. Stahl) Organization: RWTH Aachen, Lehrstuhl f. Betriebssysteme Lines: 15 Summary: Expires: Sender: Followup-To: Distribution: Keywords: In article slores%gables.span@umigw.miami.edu (Stanislaw L. Olejniczak) writes: >PLEASE don't flame for posting too simple a question. I think the following >SHOULD work, but will not even compile: > while ( (c = getchar) != EOF) > chcnt++ += (c == '\n'); >... this would be too complex for a compiler. ... The answer is quite simple: "+=" is an assignment operator, on it's left side are only "lvalue"s allowed. But "chcnt++" is an expression with the result "1 + previous_value(chcnt)", and you cannot assign anything to an expression, even in C ... I hope this helps! Hans-Ludwig Stahl