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

*& 的含義和**&在 C++ 中

Meaning of *amp; and **amp; in C++(*amp; 的含義和**amp;在 C++ 中)
本文介紹了*& 的含義和**&在 C++ 中的處理方法,對大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

限時(shí)送ChatGPT賬號(hào)..

我在函數(shù)聲明中多次發(fā)現(xiàn)這些符號(hào),但我不知道它們是什么意思.

I found these symbols in a function declaration several times, but I don't know what they mean.

示例:

void raccogli_dati(double **& V, double **p, int N) { 
  int ultimo = 3; 
  V = new double * [N/2]; 
  for(int i=0; i < N/2; i++) { 
    V[i] = new double[N/2], std :: clog << "digita " << N/2 - i
                 << " valori per la parte superiore della matrice V: "; 
    for(int j=i; j < N/2; j++) 
      std :: cin >> V[i][j], p[ultimo++][0] = (V[i][j] /= sqrt(p[i][0]*p[j][0]));
  } 
  for(int i=1; i < N/2; i++) 
    for(int j=0; j < i; j++) 
       V[i][j] = V[j][i];
}

推薦答案

即以引用方式取參數(shù).因此,在第一種情況下,您通過引用獲取指針參數(shù),因此您對指針值所做的任何修改都會(huì)反映在函數(shù)之外.第二個(gè)與第一個(gè)相似,唯一的區(qū)別是它是一個(gè)雙指針.看這個(gè)例子:

That is taking the parameter by reference. So in the first case you are taking a pointer parameter by reference so whatever modification you do to the value of the pointer is reflected outside the function. Second is the simlilar to first one with the only difference being that it is a double pointer. See this example:

void pass_by_value(int* p)
{
    //Allocate memory for int and store the address in p
    p = new int;
}

void pass_by_reference(int*& p)
{
    p = new int;
}

int main()
{
    int* p1 = NULL;
    int* p2 = NULL;

    pass_by_value(p1); //p1 will still be NULL after this call
    pass_by_reference(p2); //p2 's value is changed to point to the newly allocate memory

    return 0;
}

這篇關(guān)于*&amp; 的含義和**&amp;在 C++ 中的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

相關(guān)文檔推薦

Difference between std::reference_wrapper and simple pointer?(std::reference_wrapper 和簡單指針的區(qū)別?)
Difference between const. pointer and reference?(常量之間的區(qū)別.指針和引用?)
How to access the contents of a vector from a pointer to the vector in C++?(c++ - 如何從指向向量的指針訪問向量的內(nèi)容?)
Why can#39;t I do polymorphism with normal variables?(為什么我不能對普通變量進(jìn)行多態(tài)?)
Dereferencing deleted pointers always result in an Access Violation?(取消引用已刪除的指針總是會(huì)導(dǎo)致訪問沖突?)
Is pointer comparison undefined or unspecified behavior in C++?(C++ 中的指針比較是未定義或未指定的行為嗎?)
主站蜘蛛池模板: 免费精品一区 | 91久久夜色精品国产网站 | 精品国产一区二区三区久久久久久 | 国产在线观看一区二区三区 | 国产综合在线视频 | 久久成人一区 | 免费毛片www com cn | 国产午夜av片 | 99视频免费在线 | 欧美一二三四成人免费视频 | www成年人视频 | 日日噜噜噜夜夜爽爽狠狠视频97 | 亚洲国产一区二区三区 | 成人精品在线视频 | 色爱区综合 | 成人午夜视频在线观看 | 91欧美激情一区二区三区成人 | 91精品国产91 | 国产精品久久久久久久久免费相片 | 天天操操 | 一级少妇女片 | 一区二区三区不卡视频 | 日韩三级视频 | 久久国产成人 | 色妹子综合网 | 亚洲精品乱码久久久久久按摩 | 国产精品久久久久久久久久 | 97国产爽爽爽久久久 | 亚洲色图综合 | 国产综合网站 | 男人的天堂久久 | 国产福利视频 | 伊人爽 | 国产欧美一区二区三区在线看 | 在线视频中文字幕 | 一区二区视频在线观看 | 99re热精品视频 | 欧美一区二区三区在线观看 | 一区福利视频 | 97精品国产 | 性在线|