1. 指針數(shù)組是一個數(shù)組毡咏,它的元素是一個指針。
2. 數(shù)組指針是一個指針球化,它指向數(shù)組的首地址秽晚。
3. 指針函數(shù)是一個函數(shù),它的返回值是一個指針赊窥。
4. 函數(shù)指針是一個指針爆惧,它指向函數(shù)的入口地址。
指針本身是一個變量锨能,有自己的存儲空間扯再,又有自己的值。
理解指針常量與指針常量
const int p;
const int* p;
int const* p;
int * const p;
const int * const p;
int const * const p;
第一行是常量整數(shù)址遇,無話可說熄阻。
后面5種是指針,有個簡便的方法記憶倔约。
從右往左讀秃殉,遇到p就替換成“p is a”,遇到*就替換成“point to”
比如說第二行,讀作:p is a point to int const.
p是一個指向整型常量的指針钾军。
第三行鳄袍,讀作:p is a point to const int.
意思跟上面一樣。
第四行吏恭,讀作:p is a const point to int.
p是一個常量指針拗小,指向整型。