diff options
Diffstat (limited to 'docs/source/lang/cpp/assignment.rst')
-rw-r--r-- | docs/source/lang/cpp/assignment.rst | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/docs/source/lang/cpp/assignment.rst b/docs/source/lang/cpp/assignment.rst index b6ad4d5..f9430b4 100644 --- a/docs/source/lang/cpp/assignment.rst +++ b/docs/source/lang/cpp/assignment.rst @@ -15,47 +15,38 @@ 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 [#fgross]_. - - Example ------- :: int sensVal; // declare an integer variable named sensVal - senVal = analogRead(0); // store the (digitized) input voltage at analog pin 0 in SensVal - - + sensVal = analogRead(0); // store the (digitized) input voltage at analog pin 0 in sensVal Programming Tips ---------------- -The variable on the left side of the assignment operator ( = sign ) +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 comparison operator [ == ] (double equal signs), which -evaluates whether two expressions are equal. - +Don't confuse the assignment operator ``=`` (single equal sign) with +the comparison operator ``==`` (double equal signs), which evaluates +whether two expressions are equal. Arduino Compatibility --------------------- Assignments on the Maple are identical to those on Arduino. - - See Also -------- - -- `if (comparison operators) <http://arduino.cc/en/Reference/If>`_ -- `char <http://arduino.cc/en/Reference/Char>`_ -- `int <http://arduino.cc/en/Reference/Int>`_ -- `long <http://arduino.cc/en/Reference/Long>`_ - +- :ref:`if <lang-if>` +- :ref:`char <lang-char>` +- :ref:`int <lang-int>` +- :ref:`long long <lang-longlong>` .. rubric:: Footnotes @@ -66,5 +57,4 @@ See Also <http://icu-project.org/docs/papers/cpp_report/the_anatomy_of_the_assignment_operator.html>`_ for more information. - .. include:: cc-attribution.txt |