2.1 assignment

Assignments in C are as follows:

<lhs> '=' <rhs>';'

In this notation, everything in <> should be replaced by something else. It is a place holder. <rhs> (right hand side) specifies an expression. The right hand side of an assignment statement is evaluated first. <lhs> (the left hand side) specifies a place to store the result from the evaluation of <rhs>. The equal symbol is quoted to indicate that it should be literal. The same applies to the semi-colon.

Note that <lhs> does not need to be a variable. It can be anything that specifies a location to store the result from <rhs>. For example, *(char*)0xbf28f0a8 is perfectly fine as an lhs for a char type <rhs>.



Copyright © 2006-09-25 by Tak Auyeung