If OP is reading and studying at the very-beginner level that he implies, then the object of that lesson (and the question) could be something very basic – This is something we beginning programmers had to have beaten into our skulls on Day One of our Beginning FORTRAN II classes.
The equal-sign = when used in an assignment statement like this means do these steps in this order:
– Compute the value of the number, variable, or expression on the RIGHT side of the =
– Then, store that result into the variable on the LEFT side.
In particular, what does this sequence of statements mean?
int i ;
i = 10 ; /* or any initial value */
i = i + 1 ;
Assuming the student knows and is accustomed to regular Algebra, the statement: i = i + 1
seems non-sensical at first. What could it mean? Just try solving for i and see if you can do it!
The = does NOT make a factual statement or claim about what is true of the expressions surrounding it, as it does in Algebra. It is an imperative verb, commanding the computer to do the steps outlined above.
To make things worse, the same equal sign was also used as an interrogative state-of-being verb in creating conditional statements, such as: IF ( A = B ) . . .
which compares the values of the expressions on both sides of the = and directs the computer to take one of two different actions according to the result.
This dual usage of the = symbol was a thorn in the butt, in the minds of many programming language designers, and indeed caused problems in designing modern languages and compilers. Accordingly, in many relatively modern languages, two different symbols were used for this purpose.
Thus, in Algol and its successors, := was used as the assignment operator, while = was kept as the conditional test operator.
OTOH, in C and its successors, = was retained as the assignment operator, while == was invented to be the conditional test operator.
Modern languages let you do obscene things, like assigning a computed expression to multiple variables in one statement: i = j = k = k + 1 ;
or even assigning to a variable inside an expression, as in:
if ( i = ( j + k ) > 0 ) . . . /* Grok that if you can! */
This led to abominations like: a* = i = i + 1 ;
What the hell does THAT do? If, say, you just increased the value of i from 4 to 5, does it also store that 5 into a or into a?