我有以下代碼:const char *的地址是什麼數據類型?
const char* names = {"apples", "oranges", "grapes"};
什麼數據類型是&name[0]
?海灣合作委員會抱怨。它不是爲const char **,因爲GCC抱怨這一點:
const char** address_of_first_name = &name[0];
"note: expected 'const char ** ' but argument is of type 'char **' "
它是常量char * const
還是什麼?頭痛正在進行......
什麼數據類型是&name[0]
?我討厭不正確地修復這個編譯器錯誤。
爲了保持一致性:您的變量名爲'names'還是'name'? – jogojapan
@B。 Nadolson:'const char * names = {「apples」,「oranges」,「grapes」};'已經不可編譯,相當無意義,嚴重影響了問題的含義。我懷疑這不是一個真正的聲明,因爲你得到的錯誤信息在這個聲明中是不可能的。請發佈真實的代碼。 – AnT
@jogojapan你說得對,我覺得不好。 –