What does the program print to the monitor?
The variable contains: 123
The program prints out the same thing as the first example program. However, this program did not initialize the variable and so had to put a value into it later.
Assignment statements look like this:
variableName = expression ;
=is the assignment operator.
Here are some example assignment statements (assume that the variables have already been declared):
total = 3 + 5; price = 34.56; tax = total*0.05;
In the source file, the variable must be declared before any assignment statement that uses that variable.
Is the following correct?
int sum; sum = 42 - 12 ;