1 #include <iostream> 2 using namespace std; 3 4 int main() 5 { 6 int num = 20; 7 int *p = # //存储num的地址 8 cout<< num <<endl; 9 cout<< p <<endl; //输出指针存储的地址 10 cout<< *p <<endl; //输出指针地址的值 11 return 0; 12 }
时间: 2024-10-12 22:40:13
1 #include <iostream> 2 using namespace std; 3 4 int main() 5 { 6 int num = 20; 7 int *p = # //存储num的地址 8 cout<< num <<endl; 9 cout<< p <<endl; //输出指针存储的地址 10 cout<< *p <<endl; //输出指针地址的值 11 return 0; 12 }