• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            我的CPP之路

            路漫漫其修遠兮
            隨筆 - 42, 文章 - 0, 評論 - 16, 引用 - 0
            數(shù)據(jù)加載中……

            &和&&

            最近在看《The C Programming Language 2nd Ed》,把其中自己認為值得注意的地方記下來。小弟水平有限,若哪個地方理解錯了還請各位GGJJ指出。先謝謝了。

            <<TCPL 2ED>>

            P46 倒數(shù)第二段 (2.9 Bitwise Operators)

            One must distinguish the bitwise operators & and | from the logical operators && and ||, which imply left-to-right evaluation of a truth value. For example, if x is 1 and y is 2, then x & y is zero while x && y is one.

            ---------

            1 & 2      就是   01 & 10 -> 00
            1 && 2   就是   true && true -> true
            無論什么語言都要注意位操作符和邏輯與或的區(qū)別。
            用程序驗證一下,gcc 3.4.2,^_^

            #include <stdio.h>

            int main() {
                
            int x = 1, y = 2;
                printf(
            "x=1, y=2\n");
                printf(
            "x & y : %d : %s\n", x & y, x & y ? "TRUE" : "FALSE");
                printf(
            "x && y : %d : %s\n", x && y, x && y ? "TRUE" : "FALSE");
            }

            輸出結果:
            x=1, y=2
            x & y : 0 : FALSE
            x && y : 1 : TRUE

            posted on 2007-12-14 12:53 yanvenhom 閱讀(521) 評論(0)  編輯 收藏 引用 所屬分類: C/C++

            国产精品日韩深夜福利久久| 国产ww久久久久久久久久| 久久久WWW成人免费精品| 国产精品青草久久久久婷婷| 国产日产久久高清欧美一区| 久久这里只有精品首页| 久久天天躁狠狠躁夜夜2020| 青春久久| 国产成人久久777777| 国产国产成人精品久久| 日本久久久久久中文字幕| 少妇被又大又粗又爽毛片久久黑人| 2019久久久高清456| 久久精品麻豆日日躁夜夜躁| 日本久久久久久久久久| 久久精品中文闷骚内射| 国产精品伦理久久久久久| 欧洲成人午夜精品无码区久久| 国产综合久久久久| 综合网日日天干夜夜久久| 久久精品国产亚洲7777| 久久精品国产久精国产| 国产精品久久久久久吹潮| 免费一级欧美大片久久网| 亚洲综合精品香蕉久久网97| 97久久婷婷五月综合色d啪蜜芽| 青青青青久久精品国产h| 精品久久综合1区2区3区激情| 色偷偷偷久久伊人大杳蕉| 婷婷久久五月天| 久久久久国产一区二区| 久久免费高清视频| 伊人久久大香线蕉影院95| 日本久久久久亚洲中字幕| 色综合久久夜色精品国产| 99久久国产宗和精品1上映| 久久亚洲国产精品123区| 久久综合伊人77777| 久久久久久伊人高潮影院| 久久强奷乱码老熟女| 成人综合久久精品色婷婷|