Begining C

Gerard Beekmans gerard at linuxfromscratch.org
Wed Feb 12 21:43:49 PST 2003


On February 12, 2003 10:27 pm, DJ Lucas wrote:
> alltogether).  How would ya'll explain this to a noob, preferably in a
> text book format, or even taken from a text that you have, so I can
> submit a decent bug report with a proposed solution?


A construction like "x = y = 5" is not a special case. It's a consequence of 
this fact: An assignment is an expression with a value, and assignments 
associate from right to left.

Instead of x = y = 5 you could write it as follows which maybe makes more 
sense: x = (y = 5)

Instead of assigning a static value (5) to a variable (x) you can write the 
assignment of a variable as an assignment. So y = 5 is an expression in 
itself (sets y to the value of 5) but because it also appears on the right 
side of the equal sign, it's also as assignment to whatever is left of the 
equal sign.




-- 
Gerard Beekmans
www.linuxfromscratch.org

-*- If Linux doesn't have the solution, you have the wrong problem -*-
-- 
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe lfs-chat' in the subject header of the message



More information about the lfs-chat mailing list