伊莉討論區
標題:
c++教學part22 指標的指標
[打印本頁]
作者:
qqqkevinwww
時間:
2009-4-9 02:02 PM
標題:
c++教學part22 指標的指標
void main()
//
主程式開始
ptr_to_ptr.cpp
{
int value = 2;
//
宣告整數變數
int *ptr_to_int = &value;
//
宣告指向整數的指標
int ** ptr_to_ptr =
&ptr_to_int ;
//
宣告指向指標的指標
cout << "
Name
|
Address
|
Value \n";
//
印出標題列
cout << "----------------------------------------------\n";
cout << "ptr_to_ptr
|
" << &ptr_to_ptr << "
|
" <<
ptr_to_ptr << endl;
//
列印
ptr_to_ptr
的位址與儲存值
cout <<
"ptr_to_int
|
" << &ptr_to_int << "
|
" <<
ptr_to_int << endl;
//
列印
ptr_to_int
的位址與儲存值
cout << "value
|
" << &value << "
|
" << value << endl;
//
列印
value
的位址與儲存值
cout << "\n*ptr_to_ptr
|
**********
|
" << *ptr_to_ptr << endl;
//
列印
*ptr_to_ptr
的位址與儲存值
cout << "**ptr_to_ptr |
**********
|
" << **ptr_to_ptr << endl;
//
列印
**ptr_to_ptr
的位址與儲存值
}
//
主程式結束
歡迎光臨 伊莉討論區 (http://a401.file-static.com/)
Powered by Discuz!