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
Operators in C and C++
(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!
==Notes== {{reflist |group="lower-alpha"|refs= <ref name="sinceCXX11" group="lower-alpha">since C++11</ref> <ref name="sinceCXX23" group="lower-alpha">since C++23</ref> <ref name="modulo" group="lower-alpha">The modulus operator only supports integer operands; for floating point, a function such as [[math.h|{{code|fmod|cpp}}]] can be used.</ref> <ref name="bitshift" group="lower-alpha">In the context of [[iostream]]s in C++, writers often will refer to {{cpp|<<}} and {{cpp|>>}} as the "put-to" or "stream insertion" and "get-from" or "stream extraction" operators, respectively.</ref> <ref name="addressof2" group="lower-alpha">The actual address of an object with an overloaded <code>operator &</code> can be obtained with [https://en.cppreference.com/w/cpp/memory/addressof <code>std::addressof</code>]</ref> <ref name="arrowptr" group="lower-alpha">The return type of {{cpp|operator->()}} must be a type for which the {{cpp |->}} operation can be applied, such as a pointer type. If {{cpp|x}} is of type {{cpp |C}} where {{cpp |C}} overloads {{cpp|operator->()}}, {{cpp|x->y}} gets expanded to {{cpp|x.operator->()->y}}.</ref> <ref name="arrowstar" group= "lower-alpha">{{Citation | publisher = Aristeia | url = http://aristeia.com/Papers/DDJ_Oct_1999.pdf | title = Implementing operator->* for Smart Pointers | first = Scott | last = Meyers | journal = Dr. Dobb's Journal |date=Oct 1999}}.</ref> <ref name="scopal" group="lower-alpha">Although a <code>::</code> punctuator exists in C as of C23, it is not used as a scope resolution operator.</ref> <ref name="ud-literal" group="lower-alpha">About [http://en.cppreference.com/w/cpp/language/user_literal C++11 User-defined literals]</ref> <ref name="sizeof" group="lower-alpha">The parentheses are not necessary when taking the size of a value, only when taking the size of a type. However, they are usually used regardless.{{Citation needed|date=July 2024}}</ref> <ref name="alignof" group = "lower-alpha">C++ defines <code>alignof</code> operator, whereas C defines <code>_Alignof</code> (C23 defines both). Both operators have the same semantics.</ref> <ref name="threewaycomparison" group="lower-alpha">About [https://en.cppreference.com/w/cpp/language/operator_comparison#Three-way_comparison C++20 three-way comparison]</ref> <ref name="infer" group="lower-alpha">The type name can also be inferred (e.g <code>new auto</code>) if an initializer is provided.</ref> <ref name="infer2" group="lower-alpha">The array size can also be inferred if an initializer is provided.</ref> }}
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)