=
Description
The single equal sign = in the C++ programming language is called the assignment operator. It has a different meaning than in algebra class where it indicated an equation or equality. The assignment operator tells the microcontroller to evaluate whatever value or expression is on the right side of the equal sign, and store it in the variable to the left of the equal sign.
Example Code
※ NOTES AND WARNINGS:
- The variable on the left side of the assignment operator ( = sign ) needs to be able to hold the value stored in it. If it is not large enough to hold a value, the value stored in the variable will be incorrect.
- Don't confuse the assignment operator = (single equal sign) with the "equal to" comparison operator == (double equal signs):
- = stores value to a variable.
- == evaluates whether two expressions are equal or not.
See Also
- Language : + (addition)
- Language : / (division)
- Language : * (multiplication)
- Language : % (remainder)
- Language : - (subtraction)
- Language : if (conditional operators)
- Language : char
- Language : int
- Language : long
※ ARDUINO BUY RECOMMENDATION
Arduino UNO R3 | |
Arduino Starter Kit |