index | next

Assignment Statements in C++

Functions in C++ usually involve assignment statements.

An assignment statement has the form:

      location = expression;
where location is a name (usually of a simple variable) and expression is an expression whose value is compatible with the variable's type.

Note: The assignment operator "=" is not to be confused with the comparison operator "=="!

Example:

      p = 1;
Here it is assumed that p has been declared to be a suitable type, probably int.


index | next