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

常量之間的區別.指針和引用?

Difference between const. pointer and reference?(常量之間的區別.指針和引用?)
本文介紹了常量之間的區別.指針和引用?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

常量指針和引用有什么區別?

What is the difference between a constant pointer and a reference?

常量指針顧名思義是不能再綁定的.參考文獻也是如此.

Constant pointer as the name implies can not be bound again. Same is the case with the reference.

我想知道在哪種情況下,一種會比另一種更受歡迎.他們的 C++ 標準和實現有何不同?

I wonder in what sort of scenarios would one be preferred over the other. How different is their C++ standard and their implementations?

干杯

推薦答案

const 指針有 3 種類型:

There are 3 types of const pointers:

//Data that p points to cannot be changed from p
const char* p = szBuffer;

//p cannot point to something different.  
char* const p = szBuffer;

//Both of the above restrictions apply on p
const char* const p = szBuffer;

上面的方法#2 與參考文獻最相似.

Method #2 above is most similar to a reference.

引用和上述所有 3 種類型的 const 指針之間存在主要區別:

There are key differences between references and all of the 3 types of const pointers above:

  • 常量指針可以為 NULL.

  • Const pointers can be NULL.

引用沒有自己的地址,而指針有.
引用的地址是實際對象的地址.

A reference does not have its own address whereas a pointer does.
The address of a reference is the actual object's address.

一個指針有它自己的地址,并且它的值是它指向的值的地址.

A pointer has its own address and it holds as its value the address of the value it points to.

在此處查看 我的回答參考和指針之間的更多區別.

這篇關于常量之間的區別.指針和引用?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

相關文檔推薦

Difference between std::reference_wrapper and simple pointer?(std::reference_wrapper 和簡單指針的區別?)
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?(取消引用已刪除的指針總是會導致訪問沖突?)
Is pointer comparison undefined or unspecified behavior in C++?(C++ 中的指針比較是未定義或未指定的行為嗎?)
主站蜘蛛池模板: 精品一二三区 | 成年人的免费视频 | 中文字幕亚洲欧美 | 午夜免费av | 黄av在线 | 中文字幕不卡在线观看 | www.伊人| 久久精品视频免费 | 日本不卡视频 | 日韩色在线 | 亚洲成人久久久 | 麻豆一区二区三区 | 日韩欧美在线一区二区 | 成人在线一区二区 | 中文字幕在线免费观看视频 | 黄色录像免费看 | 国产精品美女 | 美国一级大黄一片免费中文 | 男人操女人的网站 | 午夜免费福利 | 欧美午夜精品久久久久免费视 | 亚洲一区二区免费 | 国产激情一区二区三区 | 欧美日韩在线一区 | 中文字幕不卡视频 | 日韩中文字幕在线 | 午夜影院在线免费观看 | 国产精品一区二区三区四区 | 亚洲久久久久久 | 中文字幕高清在线 | 久久精品国产视频 | 国产无遮挡又黄又爽又色 | 日韩欧美在线播放 | 91视频亚洲 | 毛片网站在线播放 | 日韩精品在线播放 | 日韩中文视频 | 色综合久久久久 | 日本视频一区二区三区 | 欧美视频二区 | 久久久久久久国产精品 |