Files
hustoj/web/cppreference-zh/chmhelp/cpp-language-operator_precedence.html
2025-08-01 12:57:54 +08:00

320 lines
29 KiB
HTML

<!DOCTYPE html>
<html lang="zh" dir="ltr" class="client-nojs" xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh">
<head><meta http-equiv="x-ua-compatible" content="ie=edge">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>C++ &#36939;&#31639;&#20803;&#20778;&#20808;&#24207;</title>
<link rel="stylesheet" href="ext.css" />
<link rel="stylesheet" href="site_modules.css" />
</head>
<body class="mediawiki ltr sitedir-ltr ns-0 ns-subject page-cpp_language_operator_precedence skin-cppreference2 action-view cpp-navbar">
<div id="cpp-content-base">
<div id="content"><a id="top"></a>
<h1 id="firstHeading" class="firstHeading">C++ &#36939;&#31639;&#20803;&#20778;&#20808;&#24207;</h1>
<div id="bodyContent">
<div id="contentSub"><span class="subpages">&lt; <a href="cpp.html">cpp</a>&lrm; | <a href="cpp-language.html">language</a></span></div>
<div id="mw-content-text" lang="zh" dir="ltr" class="mw-content-ltr" xml:lang="zh">
<p>&#19979;&#34920;&#21015;&#20986; C++ &#36939;&#31639;&#20803;&#30340;&#20778;&#20808;&#24207;&#21644;&#32467;&#21512;&#24615;&#12290;&#21508;&#20010;&#36939;&#31639;&#20803;&#20197;&#20778;&#20808;&#24207;&#30340;&#38477;&#24207;&#20174;&#19978;&#33267;&#19979;&#21015;&#20986;&#12290;</p>
<table class="wikitable">
<tr>
<th style="text-align: left">&#20778;&#20808;&#24207;</th>
<th style="text-align: left">&#36939;&#31639;&#20803;</th>
<th style="text-align: left">&#25551;&#36848;</th>
<th style="text-align: left">&#32467;&#21512;&#24615;</th>
</tr>
<tr>
<th>1</th>
<td><code>::</code></td>
<td><a href="cpp-language-identifiers.html#.E6.9C.89.E9.99.90.E5.AE.9A.E7.9A.84.E6.A0.87.E8.AF.86.E7.AC.A6">&#20316;&#29992;&#22495;&#35299;&#26512;</a></td>
<td style="vertical-align: top" rowspan="6">&#20174;&#24038;&#21040;&#21491;</td>
</tr>
<tr>
<th rowspan="5">2</th>
<td style="border-bottom-style: none"><code>a++</code>&nbsp;&nbsp; <code>a--</code></td>
<td style="border-bottom-style: none">&#21518;&#32512;<a href="cpp-language-operator_incdec.html">&#33258;&#22686;&#19982;&#33258;&#20943;</a></td>
</tr>
<tr>
<td style="border-bottom-style: none; border-top-style: none"><code><i>type</i>()</code>&nbsp;&nbsp; <code><i>type</i>{}</code></td>
<td style="border-bottom-style: none; border-top-style: none"><a href="cpp-language-explicit_cast.html">&#20989;&#25968;&#39118;&#26684;&#36716;&#22411;</a></td>
</tr>
<tr>
<td style="border-bottom-style: none; border-top-style: none"><code>a()</code></td>
<td style="border-bottom-style: none; border-top-style: none"><a href="cpp-language-operator_other.html#.E5.86.85.E5.BB.BA.E7.9A.84.E5.87.BD.E6.95.B0.E8.B0.83.E7.94.A8.E9.81.8B.E7.AE.97.E5.85.83">&#20989;&#25968;&#35843;&#29992;</a></td>
</tr>
<tr>
<td style="border-bottom-style: none; border-top-style: none"><code>a[]</code></td>
<td style="border-bottom-style: none; border-top-style: none"><a href="cpp-language-operator_member_access.html#.E5.86.85.E5.BB.BA.E7.9A.84.E4.B8.8B.E6.A0.87.E9.81.8B.E7.AE.97.E5.85.83">&#19979;&#26631;</a></td>
</tr>
<tr>
<td style="border-bottom-style: none; border-top-style: none"><code>.</code>&nbsp;&nbsp; <code>-&gt;</code></td>
<td style="border-bottom-style: none; border-top-style: none"><a href="cpp-language-operator_member_access.html#.E5.86.85.E5.BB.BA.E7.9A.84.E6.88.90.E5.91.98.E8.AE.BF.E9.97.AE.E9.81.8B.E7.AE.97.E5.85.83">&#25104;&#21592;&#35775;&#38382;</a></td>
</tr>
<tr>
<th rowspan="10">3</th>
<td style="border-bottom-style: none"><code>++a</code>&nbsp;&nbsp; <code>--a</code></td>
<td style="border-bottom-style: none">&#21069;&#32512;<a href="cpp-language-operator_incdec.html">&#33258;&#22686;&#19982;&#33258;&#20943;</a></td>
<td style="vertical-align: top" rowspan="10">&#20174;&#21491;&#21040;&#24038;</td>
</tr>
<tr>
<td style="border-bottom-style: none; border-top-style: none"><code>+a</code>&nbsp;&nbsp; <code>-a</code></td>
<td style="border-bottom-style: none; border-top-style: none">&#19968;&#20803;<a href="cpp-language-operator_arithmetic.html#.E4.B8.80.E5.85.83.E7.AE.97.E6.9C.AF.E9.81.8B.E7.AE.97.E5.85.83">&#21152;&#19982;&#20943;</a></td>
</tr>
<tr>
<td style="border-bottom-style: none; border-top-style: none"><code>!</code>&nbsp;&nbsp; <code>~</code></td>
<td style="border-bottom-style: none; border-top-style: none"><a href="cpp-language-operator_logical.html">&#36923;&#36753;&#38750;</a>&#21644;<a href="cpp-language-operator_arithmetic.html#.E6.8C.89.E4.BD.8D.E9.80.BB.E8.BE.91.E9.81.8B.E7.AE.97.E5.85.83">&#36880;&#20301;&#38750;</a></td>
</tr>
<tr>
<td style="border-bottom-style: none; border-top-style: none"><code>(<i>type</i>)</code></td>
<td style="border-bottom-style: none; border-top-style: none"><a href="cpp-language-explicit_cast.html">C &#39118;&#26684;&#36716;&#22411;</a></td>
</tr>
<tr>
<td style="border-bottom-style: none; border-top-style: none"><code>*a</code></td>
<td style="border-bottom-style: none; border-top-style: none"><a href="cpp-language-operator_member_access.html#.E5.86.85.E5.BB.BA.E7.9A.84.E9.97.B4.E6.8E.A5.E9.81.8B.E7.AE.97.E5.85.83">&#38388;&#25509;</a>&#65288;&#35299;&#24341;&#29992;&#65289;</td>
</tr>
<tr>
<td style="border-bottom-style: none; border-top-style: none"><code>&amp;a</code></td>
<td style="border-bottom-style: none; border-top-style: none"><a href="cpp-language-operator_member_access.html#.E5.86.85.E5.BB.BA.E7.9A.84.E5.8F.96.E5.9C.B0.E5.9D.80.E9.81.8B.E7.AE.97.E5.85.83">&#21462;&#22336;</a></td>
</tr>
<tr>
<td style="border-bottom-style: none; border-top-style: none"><code>sizeof</code></td>
<td style="border-bottom-style: none; border-top-style: none"><a href="cpp-language-sizeof.html">&#21462;&#22823;&#23567;</a><sup id="cite_ref-1" class="reference"><a href="cpp-language-operator_precedence.html#cite_note-1">[&#27880; 1]</a></sup></td>
</tr>
<tr>
<td style="border-bottom-style: none; border-top-style: none"><code>co_await</code></td>
<td style="border-bottom-style: none; border-top-style: none">await &#34920;&#36798;&#24335; <span class="t-mark-rev t-since-cxx20">(C++20)</span></td>
</tr>
<tr>
<td style="border-bottom-style: none; border-top-style: none"><code>new</code>&nbsp;&nbsp; <code>new[]</code></td>
<td style="border-bottom-style: none; border-top-style: none"><a href="cpp-language-new.html">&#21160;&#24577;&#20869;&#23384;&#20998;&#37197;</a></td>
</tr>
<tr>
<td style="border-top-style: none"><code>delete</code>&nbsp;&nbsp; <code>delete[]</code></td>
<td style="border-top-style: none"><a href="cpp-language-delete.html">&#21160;&#24577;&#20869;&#23384;&#20998;&#37197;</a></td>
</tr>
<tr>
<th>4</th>
<td><code>.*</code>&nbsp;&nbsp; <code>-&gt;*</code></td>
<td><a href="cpp-language-operator_member_access.html#.E5.86.85.E5.BB.BA.E7.9A.84.E6.88.90.E5.91.98.E6.8C.87.E9.92.88.E8.AE.BF.E9.97.AE.E9.81.8B.E7.AE.97.E5.85.83">&#25104;&#21592;&#25351;&#38024;</a></td>
<td style="vertical-align: top" rowspan="13">&#20174;&#24038;&#21040;&#21491;</td>
</tr>
<tr>
<th>5</th>
<td><code>a*b</code>&nbsp;&nbsp; <code>a/b</code>&nbsp;&nbsp; <code>a%b</code></td>
<td><a href="cpp-language-operator_arithmetic.html#.E4.B9.98.E6.B3.95.E6.80.A7.E9.81.8B.E7.AE.97.E5.85.83">&#20056;&#27861;&#12289;&#38500;&#27861;&#19982;&#20313;&#25968;</a></td>
</tr>
<tr>
<th>6</th>
<td><code>a+b</code>&nbsp;&nbsp; <code>a-b</code></td>
<td><a href="cpp-language-operator_arithmetic.html#.E5.8A.A0.E6.B3.95.E6.80.A7.E9.81.8B.E7.AE.97.E5.85.83">&#21152;&#27861;&#19982;&#20943;&#27861;</a></td>
</tr>
<tr>
<th>7</th>
<td><code>&lt;&lt;</code>&nbsp;&nbsp; <code>&gt;&gt;</code></td>
<td>&#36880;&#20301;<a href="cpp-language-operator_arithmetic.html#.E7.A7.BB.E4.BD.8D.E9.81.8B.E7.AE.97.E5.85.83">&#24038;&#31227;&#19982;&#21491;&#31227;</a></td>
</tr>
<tr>
<th>8</th>
<td><code>&lt;=&gt;</code></td>
<td><a href="cpp-language-operator_comparison.html#.E4.B8.89.E8.B7.AF.E6.AF.94.E8.BE.83">&#19977;&#36335;&#27604;&#36739;&#36939;&#31639;&#20803;</a><span class="t-mark-rev t-since-cxx20">(C++20 &#36215;)</span></td>
</tr>
<tr>
<th rowspan="2">9</th>
<td style="border-bottom-style: none"><code>&lt;</code>&nbsp;&nbsp; <code>&lt;=</code></td>
<td style="border-bottom-style: none">&#20998;&#21035;&#20026; &lt; &#19982; &le; &#30340;<a href="cpp-language-operator_comparison.html">&#20851;&#31995;&#36939;&#31639;&#20803;</a></td>
</tr>
<tr>
<td style="border-top-style: none"><code>&gt;</code>&nbsp;&nbsp; <code>&gt;=</code></td>
<td style="border-top-style: none">&#20998;&#21035;&#20026; &gt; &#19982; &ge; &#30340;<a href="cpp-language-operator_comparison.html">&#20851;&#31995;&#36939;&#31639;&#20803;</a></td>
</tr>
<tr>
<th>10</th>
<td><code>==</code>&nbsp;&nbsp; <code>!=</code></td>
<td>&#20998;&#21035;&#20026; = &#19982; &ne; &#30340;<a href="cpp-language-operator_comparison.html">&#30456;&#31561;&#24615;&#36939;&#31639;&#20803;</a></td>
</tr>
<tr>
<th>11</th>
<td><code>a&amp;b</code></td>
<td><a href="cpp-language-operator_arithmetic.html#.E6.8C.89.E4.BD.8D.E9.80.BB.E8.BE.91.E9.81.8B.E7.AE.97.E5.85.83">&#36880;&#20301;&#19982;</a></td>
</tr>
<tr>
<th>12</th>
<td><code>^</code></td>
<td><a href="cpp-language-operator_arithmetic.html#.E6.8C.89.E4.BD.8D.E9.80.BB.E8.BE.91.E9.81.8B.E7.AE.97.E5.85.83">&#36880;&#20301;&#24322;&#25110;</a>&#65288;&#20114;&#26021;&#25110;&#65289;</td>
</tr>
<tr>
<th>13</th>
<td><code>|</code></td>
<td><a href="cpp-language-operator_arithmetic.html#.E6.8C.89.E4.BD.8D.E9.80.BB.E8.BE.91.E9.81.8B.E7.AE.97.E5.85.83">&#36880;&#20301;&#25110;</a>&#65288;&#21487;&#20860;&#25110;&#65289;</td>
</tr>
<tr>
<th>14</th>
<td><code>&amp;&amp;</code></td>
<td><a href="cpp-language-operator_logical.html">&#36923;&#36753;&#19982;</a></td>
</tr>
<tr>
<th>15</th>
<td><code>||</code></td>
<td><a href="cpp-language-operator_logical.html">&#36923;&#36753;&#25110;</a></td>
</tr>
<tr>
<th rowspan="8">16</th>
<td style="border-bottom-style: none"><code>a?b:c</code></td>
<td style="border-bottom-style: none"><a href="cpp-language-operator_other.html#.E6.9D.A1.E4.BB.B6.E9.81.8B.E7.AE.97.E5.85.83">&#19977;&#20803;&#26465;&#20214;</a><sup id="cite_ref-2" class="reference"><a href="cpp-language-operator_precedence.html#cite_note-2">[&#27880; 2]</a></sup></td>
<td style="vertical-align: top" rowspan="8">&#20174;&#21491;&#21040;&#24038;</td>
</tr>
<tr>
<td style="border-bottom-style: none; border-top-style: none"><code>throw</code></td>
<td style="border-bottom-style: none; border-top-style: none"><a href="cpp-language-throw.html">throw &#36939;&#31639;&#20803;</a></td>
</tr>
<tr>
<td style="border-bottom-style: none; border-top-style: none"><code>co_yield</code></td>
<td style="border-bottom-style: none; border-top-style: none">yield &#34920;&#36798;&#24335; <span class="t-mark-rev t-since-cxx20">(C++20)</span></td>
</tr>
<tr>
<td style="border-bottom-style: none; border-top-style: none"><code>=</code></td>
<td style="border-bottom-style: none; border-top-style: none"><a href="cpp-language-operator_assignment.html#.E5.86.85.E5.BB.BA.E7.9A.84.E7.9B.B4.E6.8E.A5.E8.B5.8B.E5.80.BC">&#30452;&#25509;&#36171;&#20540;</a>&#65288;C++ &#31867;&#40664;&#35748;&#25552;&#20379;&#65289;</td>
</tr>
<tr>
<td style="border-bottom-style: none; border-top-style: none"><code>+=</code>&nbsp;&nbsp; <code>-=</code></td>
<td style="border-bottom-style: none; border-top-style: none">&#20197;&#21644;&#21450;&#24046;<a href="cpp-language-operator_assignment.html#.E5.86.85.E5.BB.BA.E7.9A.84.E5.A4.8D.E5.90.88.E8.B5.8B.E5.80.BC">&#22797;&#21512;&#36171;&#20540;</a></td>
</tr>
<tr>
<td style="border-bottom-style: none; border-top-style: none"><code>*=</code>&nbsp;&nbsp; <code>/=</code>&nbsp;&nbsp; <code>%=</code></td>
<td style="border-bottom-style: none; border-top-style: none">&#20197;&#31215;&#12289;&#21830;&#21450;&#20313;&#25968;<a href="cpp-language-operator_assignment.html#.E5.86.85.E5.BB.BA.E7.9A.84.E5.A4.8D.E5.90.88.E8.B5.8B.E5.80.BC">&#22797;&#21512;&#36171;&#20540;</a></td>
</tr>
<tr>
<td style="border-bottom-style: none; border-top-style: none"><code>&lt;&lt;=</code>&nbsp;&nbsp; <code>&gt;&gt;=</code></td>
<td style="border-bottom-style: none; border-top-style: none">&#20197;&#36880;&#20301;&#24038;&#31227;&#21450;&#21491;&#31227;<a href="cpp-language-operator_assignment.html#.E5.86.85.E5.BB.BA.E7.9A.84.E5.A4.8D.E5.90.88.E8.B5.8B.E5.80.BC">&#22797;&#21512;&#36171;&#20540;</a></td>
</tr>
<tr>
<td style="border-top-style: none"><code>&amp;=</code>&nbsp;&nbsp; <code>^=</code>&nbsp;&nbsp; <code>|=</code></td>
<td style="border-top-style: none">&#20197;&#36880;&#20301;&#19982;&#12289;&#24322;&#25110;&#21450;&#25110;<a href="cpp-language-operator_assignment.html#.E5.86.85.E5.BB.BA.E7.9A.84.E5.A4.8D.E5.90.88.E8.B5.8B.E5.80.BC">&#22797;&#21512;&#36171;&#20540;</a></td>
</tr>
<tr>
<th>17</th>
<td><code>,</code></td>
<td><a href="cpp-language-operator_other.html#.E5.86.85.E5.BB.BA.E7.9A.84.E9.80.97.E5.8F.B7.E9.81.8B.E7.AE.97.E5.85.83">&#36887;&#21495;</a></td>
<td>&#20174;&#24038;&#21040;&#21491;</td>
</tr>
</table>
<ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="cpp-language-operator_precedence.html#cite_ref-1">&uarr;</a></span> <span class="reference-text"><code>sizeof</code> &#30340;&#25805;&#20316;&#25968;&#19981;&#33021;&#26159; C &#39118;&#26684;&#36716;&#22411;&#65306;&#34920;&#36798;&#24335; <code>sizeof (int) * p</code> &#26080;&#27495;&#20041;&#22320;&#35299;&#37322;&#25104; <code>(sizeof(int)) * p</code> &#65292;&#32780;&#38750; <code>sizeof((int)*p)</code>&#12290;</span></li>
<li id="cite_note-2"><span class="mw-cite-backlink"><a href="cpp-language-operator_precedence.html#cite_ref-2">&uarr;</a></span> <span class="reference-text">&#26465;&#20214;&#36939;&#31639;&#20803;&#20013;&#37096;&#65288;<code><b>?</b></code> &#19982; <code><b>:</b></code> &#20043;&#38388;&#65289;&#30340;&#34920;&#36798;&#24335;&#20998;&#26512;&#20026;&#22914;&#21516;&#20854;&#24102;&#26377;&#25324;&#21495;&#65306;&#24573;&#30053;&#20854;&#30456;&#23545;&#20110; <code>?:</code> &#30340;&#20778;&#20808;&#24207;&#12290;</span></li>
</ol>
<p>&#20998;&#26512;&#34920;&#36798;&#24335;&#26102;&#65292;&#21015;&#20110;&#19978;&#38754;&#34920;&#20013;&#26576;&#34892;&#30340;&#36939;&#31639;&#20803;&#65292;&#23558;&#27604;&#21015;&#20110;&#20302;&#20110;&#23427;&#30340;&#34892;&#20013;&#25317;&#26377;&#36739;&#20302;&#20778;&#20808;&#24207;&#30340;&#20219;&#20309;&#36939;&#31639;&#20803;&#65292;&#26356;&#32039;&#23494;&#22320;&#19982;&#20854;&#23454;&#21442;&#30456;&#32465;&#23450;&#65288;&#22914;&#21516;&#29992;&#20102;&#25324;&#21495;&#65289;&#12290;&#20363;&#22914;&#65292;&#34920;&#36798;&#24335; <span class="t-c"><span class="mw-geshi cpp source-cpp"><a href="cpp-io-cout.html"><span class="kw1758">std::<span class="me2">cout</span></span></a> <span class="sy1">&lt;&lt;</span> a <span class="sy3">&amp;</span> b</span></span> &#21644; <span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="sy2">*</span>p<span class="sy2">++</span></span></span> &#20250;&#34987;&#20998;&#26512;&#20026; <span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="br0">(</span><a href="cpp-io-cout.html"><span class="kw1758">std::<span class="me2">cout</span></span></a> <span class="sy1">&lt;&lt;</span> a<span class="br0">)</span> <span class="sy3">&amp;</span> b</span></span> &#21644; <span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="sy2">*</span><span class="br0">(</span>p<span class="sy2">++</span><span class="br0">)</span></span></span>&#65292;&#32780;&#38750; <span class="t-c"><span class="mw-geshi cpp source-cpp"><a href="cpp-io-cout.html"><span class="kw1758">std::<span class="me2">cout</span></span></a> <span class="sy1">&lt;&lt;</span> <span class="br0">(</span>a <span class="sy3">&amp;</span> b<span class="br0">)</span></span></span> &#25110; <span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="br0">(</span><span class="sy2">*</span>p<span class="br0">)</span><span class="sy2">++</span></span></span>&#12290;</p>
<p>&#25317;&#26377;&#30456;&#21516;&#20778;&#20808;&#24207;&#30340;&#36939;&#31639;&#20803;&#20197;&#20854;&#32467;&#21512;&#24615;&#30340;&#26041;&#21521;&#19982;&#21508;&#21442;&#25968;&#32465;&#23450;&#12290;&#20363;&#22914;&#34920;&#36798;&#24335; <span class="t-c"><span class="mw-geshi cpp source-cpp">a <span class="sy1">=</span> b <span class="sy1">=</span> c</span></span> &#20250;&#34987;&#20998;&#26512;&#20026; <span class="t-c"><span class="mw-geshi cpp source-cpp">a <span class="sy1">=</span> <span class="br0">(</span>b <span class="sy1">=</span> c<span class="br0">)</span></span></span> &#32780;&#38750; <span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="br0">(</span>a <span class="sy1">=</span> b<span class="br0">)</span> <span class="sy1">=</span> c</span></span>&#65292;&#22240;&#20026;&#36171;&#20540;&#20855;&#26377;&#20174;&#21491;&#21040;&#24038;&#32467;&#21512;&#24615;&#65292;&#20294; <span class="t-c"><span class="mw-geshi cpp source-cpp">a <span class="sy2">+</span> b <span class="sy2">-</span> c</span></span> &#20250;&#34987;&#20998;&#26512;&#20026; <span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="br0">(</span>a <span class="sy2">+</span> b<span class="br0">)</span> <span class="sy2">-</span> c</span></span> &#32780;&#38750; <span class="t-c"><span class="mw-geshi cpp source-cpp">a <span class="sy2">+</span> <span class="br0">(</span>b <span class="sy2">-</span> c<span class="br0">)</span></span></span>&#65292;&#22240;&#20026;&#21152;&#27861;&#21644;&#20943;&#27861;&#20855;&#26377;&#20174;&#24038;&#21040;&#21491;&#32467;&#21512;&#24615;&#12290;</p>
<p>&#32467;&#21512;&#24615;&#35268;&#23450;&#23545;&#20110;&#19968;&#20803;&#36939;&#31639;&#20803;&#26159;&#20887;&#20313;&#30340;&#65292;&#21482;&#20026;&#23436;&#22791;&#32780;&#32473;&#20986;&#65306;&#19968;&#20803;&#21069;&#32512;&#36939;&#31639;&#20803;&#22987;&#32456;&#20174;&#21491;&#21040;&#24038;&#32467;&#21512;&#65288;<span class="t-c"><span class="mw-geshi cpp source-cpp">delete <span class="sy2">++*</span>p</span></span> &#20026; <span class="t-c"><span class="mw-geshi cpp source-cpp">delete<span class="br0">(</span><span class="sy2">++</span><span class="br0">(</span><span class="sy2">*</span>p<span class="br0">)</span><span class="br0">)</span></span></span>&#65289;&#32780;&#19968;&#20803;&#21518;&#32512;&#36939;&#31639;&#20803;&#22987;&#32456;&#20174;&#24038;&#21040;&#21491;&#32467;&#21512;&#65288;<span class="t-c"><span class="mw-geshi cpp source-cpp">a<span class="br0">[</span><span class="nu0">1</span><span class="br0">]</span><span class="br0">[</span><span class="nu0">2</span><span class="br0">]</span><span class="sy2">++</span></span></span> &#20026; <span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="br0">(</span><span class="br0">(</span>a<span class="br0">[</span><span class="nu0">1</span><span class="br0">]</span><span class="br0">)</span><span class="br0">[</span><span class="nu0">2</span><span class="br0">]</span><span class="br0">)</span><span class="sy2">++</span></span></span>&#65289;&#12290;&#35201;&#27880;&#24847;&#65292;&#32467;&#21512;&#24615;&#23545;&#25104;&#21592;&#35775;&#38382;&#36939;&#31639;&#20803;&#26159;&#26377;&#24847;&#20041;&#30340;&#65292;&#21363;&#20351;&#22312;&#23427;&#20204;&#19982;&#19968;&#20803;&#21518;&#32512;&#36939;&#31639;&#20803;&#32452;&#21512;&#26102;&#20063;&#26159;&#22914;&#27492;&#65306;<span class="t-c"><span class="mw-geshi cpp source-cpp">a.<span class="me1">b</span><span class="sy2">++</span></span></span> &#20250;&#34987;&#20998;&#26512;&#20026; <span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="br0">(</span>a.<span class="me1">b</span><span class="br0">)</span><span class="sy2">++</span></span></span> &#32780;&#38750; <span class="t-c"><span class="mw-geshi cpp source-cpp">a.<span class="br0">(</span>b<span class="sy2">++</span><span class="br0">)</span></span></span>&#12290;</p>
<p>&#36939;&#31639;&#20803;&#20778;&#20808;&#24207;&#19981;&#21463;<a href="cpp-language-operators.html">&#36939;&#31639;&#20803;&#37325;&#36733;</a>&#24433;&#21709;&#12290;&#20363;&#22914;&#65292;<span class="t-c"><span class="mw-geshi cpp source-cpp"><a href="cpp-io-cout.html"><span class="kw1758">std::<span class="me2">cout</span></span></a> <span class="sy1">&lt;&lt;</span> a <span class="sy4">?</span> b <span class="sy4">:</span> c<span class="sy4">;</span></span></span> &#20250;&#34987;&#20998;&#26512;&#20026; <span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="br0">(</span><a href="cpp-io-cout.html"><span class="kw1758">std::<span class="me2">cout</span></span></a> <span class="sy1">&lt;&lt;</span> a<span class="br0">)</span> <span class="sy4">?</span> b <span class="sy4">:</span> c<span class="sy4">;</span></span></span>&#65292;&#22240;&#20026;&#31639;&#26415;&#24038;&#31227;&#30340;&#20778;&#20808;&#24207;&#39640;&#20110;&#26465;&#20214;&#36939;&#31639;&#20803;&#12290;</p>
<h3><span class="mw-headline" id=".E6.B3.A8.E8.A7.A3">&#27880;&#35299;</span></h3>
<p>&#20778;&#20808;&#24207;&#21644;&#32467;&#21512;&#24615;&#26159;&#32534;&#35793;&#26102;&#27010;&#24565;&#65292;&#19982;<a href="cpp-language-eval_order.html">&#27714;&#20540;&#39034;&#24207;</a>&#26080;&#20851;&#65292;&#21518;&#32773;&#26159;&#36816;&#34892;&#26102;&#27010;&#24565;&#12290;</p>
<p>&#26631;&#20934;&#33258;&#36523;&#19981;&#25351;&#23450;&#20778;&#20808;&#24207;&#12290;&#23427;&#20204;&#26159;&#20174;&#25991;&#27861;&#23548;&#20986;&#30340;&#12290;</p>
<p>&#34920;&#20013;&#24182;&#26410;&#21253;&#25324; <a href="cpp-language-const_cast.html"><code>const_cast</code></a>&#12289;<a href="cpp-language-static_cast.html"><code>static_cast</code></a>&#12289;<a href="cpp-language-dynamic_cast.html"><code>dynamic_cast</code></a>&#12289;<a href="cpp-language-reinterpret_cast.html"><code>reinterpret_cast</code></a>&#12289;<a href="cpp-language-typeid.html"><code>typeid</code></a>&#12289;<a href="cpp-language-sizeof....html"><code>sizeof...</code></a>&#12289;<a href="cpp-language-noexcept.html"><code>noexcept</code></a> &#21450; <a href="cpp-language-alignof.html"><code>alignof</code></a>&#65292;&#22240;&#20026;&#23427;&#20204;&#20915;&#19981;&#20250;&#26377;&#27495;&#20041;&#12290;</p>
<p>&#19968;&#20123;&#36939;&#31639;&#20803;&#25317;&#26377;<a href="cpp-language-operator_alternative.html">&#20195;&#29992;&#20889;&#27861;</a>&#65288;&#20363;&#22914;&#65292;<code>&amp;&amp;</code> &#21487;&#20026; <span class="t-c"><span class="mw-geshi cpp source-cpp">and</span></span>&#12289;<code>||</code> &#21487;&#20026; <span class="t-c"><span class="mw-geshi cpp source-cpp">or</span></span>&#12289;<code>!</code> &#21487;&#20026; <span class="t-c"><span class="mw-geshi cpp source-cpp">not</span></span> &#31561;&#65289;&#12290;</p>
<p>C &#20013;&#65292;&#19977;&#20803;&#26465;&#20214;&#36939;&#31639;&#20803;&#25317;&#26377;&#39640;&#20110;&#36171;&#20540;&#36939;&#31639;&#20803;&#30340;&#20778;&#20808;&#24207;&#12290;&#22240;&#27492;&#65292;&#34920;&#36798;&#24335; <span class="t-c"><span class="mw-geshi cpp source-cpp">e <span class="sy1">=</span> a <span class="sy1">&lt;</span> d <span class="sy4">?</span> a<span class="sy2">++</span> <span class="sy4">:</span> a <span class="sy1">=</span> d</span></span> &#22312; C++ &#20013;&#21078;&#26512;&#25104; <span class="t-c"><span class="mw-geshi cpp source-cpp">e <span class="sy1">=</span> <span class="br0">(</span><span class="br0">(</span>a <span class="sy1">&lt;</span> d<span class="br0">)</span> <span class="sy4">?</span> <span class="br0">(</span>a<span class="sy2">++</span><span class="br0">)</span> <span class="sy4">:</span> <span class="br0">(</span>a <span class="sy1">=</span> d<span class="br0">)</span><span class="br0">)</span></span></span>&#65292;&#20294;&#22312; C &#20013;&#20250;&#30001;&#20110; C &#30340;&#35821;&#27861;&#25110;&#35821;&#20041;&#21046;&#32422;&#32780;&#32534;&#35793;&#22833;&#36133;&#12290;&#32454;&#33410;&#35265;&#23545;&#24212;&#30340; C &#39029;&#38754;&#12290;</p>
<h3><span class="mw-headline" id=".E5.8F.82.E9.98.85">&#21442;&#38405;</span></h3>
<table class="wikitable">
<tr style="text-align:center">
<th colspan="7">&#24120;&#35265;&#36816;&#31639;&#31526;</th>
</tr>
<tr style="text-align:center">
<td><a href="cpp-language-operator_assignment.html">&#36171;&#20540;</a></td>
<td><a href="cpp-language-operator_incdec.html">&#33258;&#22686;<br />
&#33258;&#20943;</a></td>
<td><a href="cpp-language-operator_arithmetic.html">&#31639;&#26415;</a></td>
<td><a href="cpp-language-operator_logical.html">&#36923;&#36753;</a></td>
<td><a href="cpp-language-operator_comparison.html">&#27604;&#36739;</a></td>
<td><a href="cpp-language-operator_member_access.html">&#25104;&#21592;&#35775;&#38382;</a></td>
<td><a href="cpp-language-operator_other.html">&#20854;&#20182;</a></td>
</tr>
<tr style="text-align:center">
<td>
<p><span class="t-c"><span class="mw-geshi cpp source-cpp">a <span class="sy1">=</span> b<br />
a <span class="sy2">+</span><span class="sy1">=</span> b<br />
a <span class="sy2">-</span><span class="sy1">=</span> b<br />
a <span class="sy2">*</span><span class="sy1">=</span> b<br />
a <span class="sy2">/</span><span class="sy1">=</span> b<br />
a <span class="sy2">%</span><span class="sy1">=</span> b<br />
a <span class="sy3">&amp;</span><span class="sy1">=</span> b<br />
a <span class="sy3">|</span><span class="sy1">=</span> b<br />
a <span class="sy3">^</span><span class="sy1">=</span> b<br />
a <span class="sy1">&lt;&lt;=</span> b<br />
a <span class="sy1">&gt;&gt;=</span> b</span></span></p>
</td>
<td>
<p><span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="sy2">++</span>a<br />
<span class="sy2">--</span>a<br />
a<span class="sy2">++</span><br />
a<span class="sy2">--</span></span></span></p>
</td>
<td>
<p><span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="sy2">+</span>a<br />
<span class="sy2">-</span>a<br />
a <span class="sy2">+</span> b<br />
a <span class="sy2">-</span> b<br />
a <span class="sy2">*</span> b<br />
a <span class="sy2">/</span> b<br />
a <span class="sy2">%</span> b<br />
~a<br />
a <span class="sy3">&amp;</span> b<br />
a <span class="sy3">|</span> b<br />
a <span class="sy3">^</span> b<br />
a <span class="sy1">&lt;&lt;</span> b<br />
a <span class="sy1">&gt;&gt;</span> b</span></span></p>
</td>
<td>
<p><span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="sy3">!</span>a<br />
a <span class="sy3">&amp;&amp;</span> b<br />
a <span class="sy3">||</span> b</span></span></p>
</td>
<td>
<p><span class="t-c"><span class="mw-geshi cpp source-cpp">a <span class="sy1">==</span> b<br />
a <span class="sy3">!</span><span class="sy1">=</span> b<br />
a <span class="sy1">&lt;</span> b<br />
a <span class="sy1">&gt;</span> b<br />
a <span class="sy1">&lt;=</span> b<br />
a <span class="sy1">&gt;=</span> b<br />
a <span class="sy1">&lt;=&gt;</span> b</span></span></p>
</td>
<td>
<p><span class="t-c"><span class="mw-geshi cpp source-cpp">a<span class="br0">[</span>b<span class="br0">]</span><br />
<span class="sy2">*</span>a<br />
<span class="sy3">&amp;</span>a<br />
a<span class="sy2">-</span><span class="sy1">&gt;</span>b<br />
a.<span class="me1">b</span><br />
a<span class="sy2">-</span><span class="sy1">&gt;</span><span class="sy2">*</span>b<br />
a.<span class="sy2">*</span>b</span></span></p>
</td>
<td>
<p><span class="t-c"><span class="mw-geshi cpp source-cpp">a<span class="br0">(</span>...<span class="br0">)</span><br />
a, b<br />
<span class="sy4">?</span> <span class="sy4">:</span></span></span></p>
</td>
</tr>
<tr>
<th colspan="7">&#29305;&#27530;&#36816;&#31639;&#31526;</th>
</tr>
<tr>
<td colspan="7">
<p><a href="cpp-language-static_cast.html"><tt>static_cast</tt></a> &#36716;&#25442;&#19968;&#20010;&#31867;&#22411;&#20026;&#21478;&#19968;&#30456;&#20851;&#31867;&#22411;<br />
<a href="cpp-language-dynamic_cast.html"><tt>dynamic_cast</tt></a> &#22312;&#32487;&#25215;&#23618;&#32423;&#20013;&#36716;&#25442;<br />
<a href="cpp-language-const_cast.html"><tt>const_cast</tt></a> &#28155;&#21152;&#25110;&#31227;&#38500; <a href="cpp-language-cv.html">cv</a> &#38480;&#23450;&#31526;<br />
<a href="cpp-language-reinterpret_cast.html"><tt>reinterpret_cast</tt></a> &#36716;&#25442;&#31867;&#22411;&#21040;&#26080;&#20851;&#31867;&#22411;<br />
<a href="cpp-language-explicit_cast.html">C &#39118;&#26684;&#36716;&#22411;</a> &#20197; <code>static_cast</code> &#12289; <code>const_cast</code> &#21450; <code>reinterpret_cast</code> &#30340;&#28151;&#21512;&#36716;&#25442;&#19968;&#20010;&#31867;&#22411;&#21040;&#21478;&#19968;&#31867;&#22411;<br />
<a href="cpp-language-new.html"><tt>new</tt></a> &#21019;&#24314;&#26377;&#21160;&#24577;&#23384;&#20648;&#26399;&#30340;&#23545;&#35937;<br />
<a href="cpp-language-delete.html"><tt>delete</tt></a> &#38144;&#27585;&#20808;&#21069;&#30001; new &#34920;&#36798;&#24335;&#21019;&#24314;&#30340;&#23545;&#35937;&#65292;&#24182;&#37322;&#25918;&#20854;&#25152;&#25317;&#26377;&#30340;&#20869;&#23384;&#21306;&#22495;<br />
<a href="cpp-language-sizeof.html"><tt>sizeof</tt></a> &#26597;&#35810;&#31867;&#22411;&#30340;&#22823;&#23567;<br />
<a href="cpp-language-sizeof....html"><tt>sizeof...</tt></a> &#26597;&#35810;<a href="cpp-language-parameter_pack.html">&#24418;&#21442;&#21253;</a>&#30340;&#22823;&#23567;<span class="t-mark-rev t-since-cxx11">(C++11 &#36215;)</span><br />
<a href="cpp-language-typeid.html"><tt>typeid</tt></a> &#26597;&#35810;&#31867;&#22411;&#30340;&#31867;&#22411;&#20449;&#24687;<br />
<a href="cpp-language-noexcept.html"><tt>noexcept</tt></a> &#26597;&#35810;&#34920;&#36798;&#24335;&#26159;&#21542;&#33021;&#25243;&#20986;&#24322;&#24120;<span class="t-mark-rev t-since-cxx11">(C++11 &#36215;)</span><br />
<a href="cpp-language-alignof.html"><tt>alignof</tt></a> &#26597;&#35810;&#31867;&#22411;&#30340;&#23545;&#40784;&#35201;&#27714;<span class="t-mark-rev t-since-cxx11">(C++11 &#36215;)</span></p>
</td>
</tr>
</table>
<table class="t-dsc-begin"></table>
</div>
<div class="visualClear"></div>
</div>
</div>
</div>
</body>
</html>