開發平台(Platform): (Ex: Win10, Linux, ...)
WIN10
編譯器(Ex: GCC, clang, VC++...)+目標環境(跟開發平台不同的話需列出)
VC++
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
問題(Question):
餵入的資料(Input):
預期的正確結果(Expected Output):
錯誤結果(Wrong Output):
程式碼(Code):(請善用置底文網頁, 記得排版,禁止使用圖檔)
A.cpp
double* m_Matrix;
m_Matrix = new double[16];
const double *t_refer = m_Matrix; //指向常數的指標
GetMode(t_refer);
B.cpp
double* m_SecMatrix;
m_SecMatrix = new double[16];
GetMode(const double* &m_matrix)
{
m_matrix = m_SecMatrix;
}
補充說明(Supplement):
想請問各位前輩這個程式片段
指向常數的指標改變指標是合法的
為什麼B.cpp 裡要用 & 的符號呢?