看板 Programming 關於我們 聯絡資訊
※ 引述《jiannrong@kkcity.com.tw ( )》之銘言: : #include<iostream> : using namespace std; : int main( ) : { : char a[]={'1','2','3','4','\0'}; : cout<<a<<endl; : cout<<a[0]<<endl; : cout<<&(a[0])<<endl;//這一行為何顯示1234呢? &[a[0]]是a 陣列的開始位置大約等於 *a, 因此會顯示至第一個遇到的'\0'字元. : cout<<&a<<endl; : cout<<&a+1<<endl; : cout<<a+1<<endl;//為什麼不是2 而是234呢? 這... 不清楚. XD : system("pause"); : return 0; : } : 謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 202.134.126.84