Table of Contents
The assignment operator = assigns the value of the expression on its right to the variable on its left.
#include <stdio.h>
int main()
{
int number;
number = 10;
printf("number = %d\n", number);
number = 25;
printf("number = %d\n", number);
return 0;
}
Example Output #
number = 10
number = 25
Explanation #
The assignment:
number = 10;
stores the value 10 in number.
A later assignment:
number = 25;
replaces the previous value with 25.
The right side of an assignment is evaluated first, and its result is assigned to the left operand. The left operand must be a modifiable object that can store the resulting value.