Assigning values to C and C++ variables
To assign a value to a C and C++ variable, you use an assignment expression. Assignment expressions assign a value to the left operand. The left operand must be a modifiable lvalue. An lvalue is an expression representing a data object that can be examined and altered.
C contains two types of assignment operators: simple and compound. A simple assignment operator gives the value of the right operand to the left operand.
Note: Only the assignment operators that work for C will
work for C++, that is, there is no support for overloaded operators.
The following example demonstrates how to assign the value of
number
to the member employee
of
the structure payroll
:
payroll.employee = number;
Compound assignment operators perform an operation on both operands
and give the result of that operation to the left operand. For example,
this expression gives the value of
index plus 2
to the
variable index
:
index += 2
z/OS® Debugger supports all C operators except the tenary operator, as well as any other full C language assignments and function calls to user or C library functions.
Refer to the following topics for more information related to the material discussed in this topic.
- Related tasks
- Calling C and C++ functions from z/OS Debugger