久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

參數中的星號和與號

Both asterisk and ampersand in a parameter(參數中的星號和與號)
本文介紹了參數中的星號和與號的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

我正在讀一本關于二叉搜索樹的書,然后出現了一些奇怪的事情.我在函數參數中遇到了以下聲明.

I am reading a book about Binary Search Tree and something weird came up. I came across the following declaration in a function parameter.

BinaryNode * & t

什么意思?t的地址指針?

What does it mean? Pointer of the address of t?

對于上下文,這是我看到的代碼.私有insert 函數是公共insert 函數的輔助函數,私有insert 函數使用遞歸尋找合適的插入位置.>

For context, this is the code where I saw this. The private insert function is a helper function for public insert function, and private insert function looks for the right place to insert using recursion.

class BST
{
public:
   void insert(const Comparable & item)

private:
   BinaryNode *root;
   struct BinaryNode
   {
       Comparable element;
       BinaryNode *left;
       BinaryNode *right;
       BinaryNode(const Comparable & theElement, BinaryNode *lt, BinaryNode *rt) : 
          element(theElement), left(lt), right(rt) {}
   }
   void insert(const Comparable & item, BinaryNode * & t) const;
};

推薦答案

在你的表達式中 BinaryNode * &t)

            BinaryNode*                & t
           -------------              -----
            BinaryNode pointer        t is reference variable  

so t 是對 BinaryNode 類的指針的引用.

so t is reference to pointer of BinaryNode class.

t 的地址指針?

您對 C++ 中的 & 運算符感到困惑.給出一個變量的地址.但語法不同.

You are confused ampersand & operator in c++. that give address of an variable. but syntax is different.

& 在一些變量前面,如下所示:

ampersand & in front of some of variable like below:

BinaryNode b;
BinaryNode* ptr = &b;

但是下面的方式是用于引用變量(它的簡單不是指針):

But following way is for reference variable (its simple not pointer):

BinaryNode b;
BinaryNode & t  = b; 

你的如下:

BinaryNode b;
BinaryNode* ptr = &b;
BinaryNode* &t  = ptr;  

這篇關于參數中的星號和與號的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Difference between std::reference_wrapper and simple pointer?(std::reference_wrapper 和簡單指針的區別?)
Difference between const. pointer and reference?(常量之間的區別.指針和引用?)
How to access the contents of a vector from a pointer to the vector in C++?(c++ - 如何從指向向量的指針訪問向量的內容?)
Meaning of *amp; and **amp; in C++(*amp; 的含義和**amp;在 C++ 中)
Why can#39;t I do polymorphism with normal variables?(為什么我不能對普通變量進行多態?)
Dereferencing deleted pointers always result in an Access Violation?(取消引用已刪除的指針總是會導致訪問沖突?)
主站蜘蛛池模板: 亚洲激情专区 | 6996成人影院网在线播放 | 在线国产一区 | 成人字幕网zmw | 免费观看色| 色偷偷人人澡人人爽人人模 | 久久久久久一区 | 久久精品中文字幕 | 91视频在线| 国产一区二区a | 免费久久精品 | 午夜欧美a级理论片915影院 | 欧美群妇大交群中文字幕 | 在线观看a视频 | 欧美一区二区三区在线观看 | 国产精品久久久 | 亚洲一区二区三区四区av | 亚洲成人三区 | 欧美一级片中文字幕 | 99久久精品视频免费 | 伊人春色在线 | 亚洲三区视频 | 国产日韩欧美一区二区 | 国产成人av一区二区三区 | 国产日本精品视频 | 亚洲三级在线 | 成人免费视频观看视频 | 日本黄色不卡视频 | 精品一区二区久久久久久久网站 | 91.com视频 | 操久久 | 国产亚洲欧美日韩精品一区二区三区 | 日本不卡一区 | 精品欧美乱码久久久久久1区2区 | 欧美国产日韩一区二区三区 | 一级a毛片 | 国产欧美精品一区二区 | 免费欧美 | 日本在线一二 | 天天干狠狠 | 亚洲一区在线播放 |