關(guān)于const 及 引用一起使用的問題
int const *p = NULL; //這是指針?biāo)赶虻淖兞繛槌A俊?/p>
int *const p = NULL; //這是指針變量為一個常量。
int x;
int const &p = x; //這是給x變量起一個別名
int &const p; //有沒有這種寫法??????
int const *p = NULL; //這是指針?biāo)赶虻淖兞繛槌A俊?/p>
int *const p = NULL; //這是指針變量為一個常量。
int x;
int const &p = x; //這是給x變量起一個別名
int &const p; //有沒有這種寫法??????
2016-03-27
舉報
2016-03-27
可以是可以,但是沒有什么用途,這樣定義的話,p還是變量,可以通過改變p來改變p的值,也可以通過a改變p的值。