女人荫蒂被添全过程13种图片,亚洲+欧美+在线,欧洲精品无码一区二区三区 ,在厨房拨开内裤进入毛片

您好,歡迎來電子發燒友網! ,新用戶?[免費注冊]

您的位置:電子發燒友網>源碼下載>C/C++語言編程>

c引用和指針的區別

大小:0.5 MB 人氣: 2017-09-27 需要積分:1

  指針和引用的定義

  在深入介紹之前我們首先來看一下指針和引用的定義、指針和引用的區別,然后分別針對指針和引用展開討論,深入細節為何有這些差異。

  指針的權威定義:

  In a declaration T D where D has the form * cv-qualifier-seqopt D1 And the type of the identifier in the declaration T D1 is “derived-declarator-type-list T”, then the type of the identifier of D is “derived-declarator-type-list cv-qualifier-seq pointer to T”。 The cv-qualifiers apply to the pointer and not to the object pointer to.

  ——摘自《ANSI C++ Standard》

  注:可能有些讀者并不明白cv-qualifier-seq

  CV-qualifiers(CV限定符)

  CV-qualifiers有三種:const-qualifier(const限定符)、Volatile-qualifier(volatile限定符)、以及const-volatile-qualifier(const-volatile限定符)。

  const類對象的非靜態、非mutable、以及非引用數據成員是const-qualified;

  volatile類對象的非靜態、非引用數據成員是volatile-qualified;

  const-volatile類對象的非靜態、非引用數據成員是const-volatile-qualified。

  當CV-qualifiers用于限定數組類型時,實際上是數組成員被該CV-qualifiers限定,而非該數組類型。

  復合類型并不因其成員被CV-qualifier限定而被該CV-qualifier限定,也就是說,即使復合類型的成員有CV-qualifier限定,該復合類型也不是CV-qualified對象。

  引用的權威定義:

  In a declaration T D where D has the form& D1 And the type of the identifier in the declaration T D1 is “derived-declarator-type-list T”, then the type of the identifier of D is “derived-declarator-type-list cv-qualifier-seq reference to T”。 Cv-qualified references are ill-formed except when the cv-qualifiers are introduced through the use of a typedef or a template type argument, in which case the cv-qualifiers are ignored.

  ——摘自《ANSI C++ Standard》

  上面這些定義初看有些難懂,如果是這樣的話,那說明你對C++還不夠熟悉,你還有很長的路要走。下面用通俗易懂的話來概述一下:

  指針-對于一個類型T,T*就是指向T的指針類型,也即一個T*類型的變量能夠保存一個T對象的地址,而類型T是可以加一些限定詞的,如const、volatile等等。見下圖,所示指針的含義:

  c引用和指針的區別

  引用-引用是一個對象的別名,主要用于函數參數和返回值類型,符號X&表示X類型的引用。見下圖,所示引用的含義:

  c引用和指針的區別

非常好我支持^.^

(0) 0%

不好我反對

(0) 0%

      發表評論

      用戶評論
      評價:好評中評差評

      發表評論,獲取積分! 請遵守相關規定!

      ?
      主站蜘蛛池模板: 昂仁县| 门头沟区| 台北县| 吴忠市| 怀仁县| 荥经县| 惠安县| 关岭| 临漳县| 庐江县| 中宁县| 宁南县| 涟水县| 合山市| 门头沟区| 衡南县| 古蔺县| 绥宁县| 平远县| 高碑店市| 珲春市| 鞍山市| 彭山县| 雷波县| 桃园市| 重庆市| 晋宁县| 仙居县| 东乡族自治县| 龙门县| 三门峡市| 高州市| 大丰市| 连云港市| 连城县| 安图县| 麻江县| 凤翔县| 双鸭山市| 望江县| 合水县|