Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Operator (computer programming)
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Semantics === The semantics of an operator may significantly differ from that of a normal function. For reference, addition is evaluated like a normal function. For example, <code>x + y</code> can be equivalent to a function <code>add(x, y)</code> in that the arguments are evaluated and then the functional behavior is applied. However, [[Assignment_(computer_science)|assignment]] is different. For example, given <code>a = b</code> the target <code>a</code> is ''not'' evaluated. Instead its value is replaced with the value of <code>b</code>. The [[scope resolution operator|scope resolution]] and element access operators (as in <code>Foo::Bar</code> and <code>a.b</code>, respectively, in the case of e.g. [[C++]]) operate on identifier names; not values. In C, for instance, the array indexing operator can be used for both read access as well as assignment. In the following example, the [[increment and decrement operators|increment operator]] reads the element value of an array and then assigns the element value. <syntaxhighlight lang=c> ++a[i]; </syntaxhighlight> The C++ <code><<</code> operator allows for [[fluent interface|fluent]] syntax by supporting a sequence of operators that affect a single argument. For example: <syntaxhighlight lang=cpp> cout << "Hello" << " " << "world!" << endl; </syntaxhighlight>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)