發布時間: March 2, 2022, 12:18 a.m. 最後更新時間: Sept. 14, 2023, 10:24 p.m. 時間限制: 1000ms 記憶體限制: 128M
請預測以下程式碼的輸出結果:
&csdc=0x7ffd39606714
&iptr=0x7ffd39606718
&ip2p=0x7ffd39606720
回答請使用上面給的記憶體位址,理論上每台電腦跑的結果會略有不同,本人無法通靈你的答案是否正確。
#include <iostream>
using namespace std;
int main(){
int csdc=3637, *iptr, **ip2p;
iptr=&csdc;
ip2p=&iptr;
cout<<"&csdc="<<&csdc<<"\n";
cout<<"iptr="<<iptr<<"\n";
cout<<"*iptr="<<*iptr<<"\n";
cout<<"&iptr="<<&iptr<<"\n";
cout<<"ip2p="<<ip2p<<"\n";
cout<<"*ip2p="<<*ip2p<<"\n";
cout<<"**ip2p="<<**ip2p<<"\n";
cout<<"&ip2p="<<&ip2p<<"\n";
return 0;
}
Nothing Input
依題敘給的記憶體位址輸出程式碼的
Nothing Here
&csdc=0x7ffd39606714 iptr=??? *iptr=??? &iptr=0x7ffd39606718 ip2p=??? *ip2p=??? **ip2p=??? &ip2p=0x7ffd39606720