1
考慮下面的代碼:C++不能從 '詮釋**' 轉換爲 'const int的**'
int** a;
const int** b;
b = a;
該代碼給出了一個錯誤:
error C2440: '=' : cannot convert from 'int **' to 'const int **'
Conversion loses qualifiers
爲什麼我不能演員演員?
當操作簡單的指針時,它工作正常。
int* a;
const int* b;
b = a;
我認爲這兩個都不應該是可能的。 – JSQuareD
在你的第一種情況下'const'是什麼內在的'int',這個const不能在賦值中被丟棄。 –
http://c-faq.com/ansi/constmismatch.html – P0W