1 int wife = 24; 2 int girlfriend = 18; 3 4 //直男型 5 int const * zhi_nan; 6 zhi_nan = &wife;//正確 7 zhi_nan = &girlfriend;//正確 8 *zhi_nan = 20;//錯誤 9 10 //暖男型 11 int * const nuan_nan; 12 nuan_nan = &wife; 13 *nuan_nan = 26;//可修改wife值 14 nuan_nan = &girlfriend;//錯誤,不容許指向其餘地址 15 16 //超級暖男型 17 const int * const superman;//不容許指向其餘地址,也不能修改變量的值 18 superman = &wife; 19 *superman = 28;//錯誤,沒法修改wife值 20 superman = &girlfriend;//錯誤,不容許訪問其餘地址 21 22 //總結:看const離int近仍是離指針變量名近,離誰近就修飾誰,誰就不能變!