The assignment operator = assigns a value to a variable / object:
int main()
{
char mychar = 'c'; // define a char variable mychar
mychar = 'd'; // assign a new value to mychar
int x = 123; // define an integer variable x
x = 456; // assign a new value to x
int y = 789; // define a new integer variable y
y = x; // assing a value of x to it
}
7.2 Arithmetic Operators
We can do arithmetic operations using arithmetic operators. Some of them are:
+ // addition
- // subtraction
* // multiplication ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.