Operators in C and C++: Difference between revisions

Content deleted Content added
Table: table is not a good name for a section; clearly it contains tables, but what are the tables showing? spoiler alert: operators
Better/shorter header text
Line 4:
This is a list of [[operator (programming)|operator]]s in the [[C (programming language)|C]] and [[C++]] [[programming language]]s.
 
All listed operators are in C++ and lacking indication otherwise, in C as well. Some tables include a "Included inIn C" column that indicates whether an operator is also in C. Note that C does not support [[operator overloading]].
 
When not overloaded, for the operators <code>&&</code>, <code>||</code>, and <code>,</code> (the [[comma operator]]), there is a [[sequence point]] after the evaluation of the first operand.
Line 17:
===Arithmetic operators===
 
All arithmetic operators exist in C and C++ have the same arithmetic operators and all can be overloaded in C++.
 
{| class="wikitable" style="width:100%"
! colspan="2" rowspan="2" | Operator nameName
! rowspan="2" | Syntax
! colspan="2" | C++ prototype examples
|-
! Asin member ofclass K
! Outsideoutside class definitions
|-
| {{rh}} colspan="2" | [[Addition]]
Line 94:
 
{| class="wikitable" style="width:100%"
! colspan="2" rowspan="2" | Operator nameName
! rowspan="2" | Syntax
! rowspan="2" | Included<br/>inIn [[C (programming language)|C]]
! colspan="2" | PrototypeC++ examplesprototype
|-
! Asin member ofclass K
! Outsideoutside class definitions
|-
| width="23%" {{rh}} colspan="2" | Equal to
Line 146:
 
{| class="wikitable" style="width:100%"
! colspan="2" rowspan="2" | Operator nameName
! rowspan="2" | Syntax
! colspan="2" | C++ prototype examples
|-
! Asin member ofclass K
! Outsideoutside class definitions
|-
| width="23%" {{rh}} colspan="2" | [[Negation|Logical negation (NOT)]]
Line 174:
 
{| class="wikitable" style="width:100%"
! colspan="2" rowspan="2" | Operator nameName
! rowspan="2" | Syntax
! colspan="2" | PrototypeC++ examplesprototype
|-
! Asin member ofclass K
! Outsideoutside class definitions
|-
| width="23%" {{rh}} colspan="2" | [[Bitwise operation#NOT|Bitwise NOT]]
Line 219:
 
{| class="wikitable" style="width:100%"
! rowspan="2" | Operator nameName
! rowspan="2" | Syntax
! colspan="2" | C++ prototype examples
|-
! Asin member ofclass K
! Outsideoutside class definitions
|-
! [[Assignment operator in C++|Direct assignment]]
Line 284:
===Member and pointer operators===
{| class="wikitable" style="width:100%"
! colspan="2" rowspan="2" | Operator nameName
! rowspan="2" | Syntax
! rowspan="2" | Can overload in C++
! rowspan="2" | Included<br/>inIn [[C (programming language)|C]]
! colspan="2" | C++ prototype examples
|-
! Asin member ofclass K
! Outsideoutside class definitions
|-
| width="23%" {{rh}} colspan="2" | [[Indexer (programming)|Subscript]]
Line 331:
===Other operators===
{| class="wikitable" style="width:100%"
! colspan="2" rowspan="2" | Operator nameName
! rowspan="2" | Syntax
! rowspan="2" | Can overload in C++
! rowspan="2" | Included<br/>inIn [[C (programming language)|C]]
! colspan="2" | PrototypeC++ examplesprototype
|-
! Asin member ofclass K
! Outsideoutside class definitions
|-
| width="12%" {{rh}} colspan="2" | [[function (programming)|Function]] call<br/>''See [[Function object]]''.