<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="1" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[1]</anchor-end> プログラム言語でよくある演算子。</p><section><h1>二項算術演算子</h1><ul><li><strong><code class="math"><var>a</var> + <var>b</var></code></strong> (C): 加算。</li><li><strong><code class="math"><var>a</var> - <var>b</var></code></strong> (C): 減算。</li><li><strong><code class="math"><var>a</var> * <var>b</var></code></strong> (C): 乗算。</li><li><strong><code class="math"><var>a</var> / <var>b</var></code></strong> (C),
<strong><code class="math"><var>a</var> div <var>b</var></code></strong>: 除算。
言語や型 (整数 or 実数) によっていろいろ。</li><li><strong><code class="math"><var>a</var> % <var>b</var></code></strong> (C),
<strong><code class="math"><var>a</var> mod <var>b</var></code></strong> 剰余。
負数の扱いは言語によっていろいろ。</li><li><strong><code class="math"><var>a</var> ** <var>b</var></code></strong>,
<strong><code class="math"><var>a</var> ^ <var>b</var></code></strong> 冪乗。
言語によって色々。</li></ul></section><section><h1>単項算術演算子</h1><ul><li><strong><code class="math"><var>a</var>++</code></strong> (C),
<strong><code class="math">++<var>a</var></code></strong> (C): 1足す。</li><li><strong><code class="math"><var>a</var>--</code></strong> (C),
<strong><code class="math">--<var>a</var></code></strong> (C): 1引く。</li><li><strong><code class="math">+<var>a</var></code></strong> (C): 単項プラス。言語によってはない。</li><li><strong><code class="math">-<var>a</var></code></strong> (C),
<strong><code class="math">~<var>a</var></code></strong>: 単項マイナス。</li></ul></section><section><h1>二項 (ビット) 論理演算子</h1><ul><li><strong><code class="math"><var>a</var> &amp; <var>b</var></code></strong> (C): ビットごとの論理積。</li><li><strong><code class="math"><var>a</var> | <var>b</var></code></strong> (C): ビットごとの論理和。</li></ul><ul><li><strong><code class="math"><var>a</var> &lt;&lt; <var>b</var></code></strong> (C): 左ビットシフト。</li><li><strong><code class="math"><var>a</var> &gt;&gt; <var>b</var></code></strong> (C): 右ビットシフト。</li></ul><ul><li><strong><code class="math"><var>a</var> ^ <var>b</var></code></strong> (C): ビットごとの排他的論理和。
あまり使わない。言語によって色々。</li></ul></section><section><h1>二項 (ビット) 論理演算子</h1><ul><li><strong><code class="math">~<var>a</var></code></strong> (C): ビットごとの論理否定。
あまり使わない。言語によって色々。</li></ul></section><section><h1>二項 (boolean) 論理演算子</h1><ul><li><strong><code class="math"><var>a</var> &amp;&amp; <var>b</var></code></strong> (C),
<strong><code class="math"><var>a</var> and <var>b</var></code></strong>: 論理積。
言語によって色々。</li><li><strong><code class="math"><var>a</var> || <var>b</var></code></strong> (C),
<strong><code class="math"><var>a</var> or <var>b</var></code></strong>: 論理和。
言語によって色々。</li></ul></section><section><h1>単項 (boolean) 論理演算子</h1><ul><li><strong><code class="math">!<var>a</var></code></strong> (C),
<strong><code class="math">not <var>a</var></code></strong>: 論理否定。
言語によって色々。</li></ul></section><section><h1>三項 (boolean) 論理演算子</h1><ul><li><strong><code class="math"><var>a</var> ? <var>b</var> : <var>c</var></code></strong> (C): 
<code>if (<var>a</var>) { <var>b</var> } else { <var>c</var> }</code></li></ul></section><section><h1>二項比較演算子</h1><ul><li><strong><code class="math"><var>a</var> &lt; <var>b</var></code></strong> (C),
<strong><code class="math"><var>a</var> &gt; <var>b</var></code></strong> (C),
<strong><code class="math"><var>a</var> &lt;= <var>b</var></code></strong> (C),
<strong><code class="math"><var>a</var> &gt;= <var>b</var></code></strong> (C),
<strong><code class="math"><var>a</var> lt <var>b</var></code></strong>,
<strong><code class="math"><var>a</var> gt <var>b</var></code></strong>,
<strong><code class="math"><var>a</var> le <var>b</var></code></strong>,
<strong><code class="math"><var>a</var> ge <var>b</var></code></strong>:
不等号。言語によって色々。</li><li><strong><code class="math"><var>a</var> = <var>b</var></code></strong>,
<strong><code class="math"><var>a</var> == <var>b</var></code></strong> (C),
<strong><code class="math"><var>a</var> eq <var>b</var></code></strong>: 等号。言語によって色々。</li><li><strong><code class="math"><var>a</var> != <var>b</var></code></strong> (C),
<strong><code class="math"><var>a</var> ne <var>b</var></code></strong>: 不等号。言語によって色々。</li></ul></section><section><h1>二項代入演算子</h1><ul><li><strong><code class="math"><var>a</var> = <var>b</var></code></strong> (C),
<strong><code class="math"><var>a</var> := <var>b</var></code></strong>,
<strong><code class="math"><var>a</var> &lt;= <var>b</var></code></strong>: 代入。
言語によって色々</li><li><strong><code class="math"><var>a</var> += <var>b</var></code></strong> など (C): 
加算などとの複合的な代入。</li></ul></section><section><h1>ポインタ</h1><ul><li><strong><code class="math">&amp;<var>a</var></code></strong> (C):
変数 <code><var>a</var></code> の<ruby>番地<rt>アドレス</rt></ruby>。</li><li><strong><code class="math">*<var>a</var></code></strong> (C):
変数 <code><var>a</var></code> (ポインタ) の<ruby>番地<rt>アドレス</rt></ruby>の指す内容。</li></ul></section><section><h1>型</h1><ul><li><strong><code class="math">(<var>type</var>) <var>a</var></code></strong> (C):
型キャスト。</li><li><strong><code class="math">sizeof <var>a</var></code></strong> (C):
変数 <code><var>a</var></code> の<ruby>記憶<rt>メモリー</rt></ruby>上の大きさ。</li></ul></section><section><h1>メモ</h1></section></body></html>