通过以下代码快速理解指针:
#include <iostream>
using namespace std;
int main()
{
int a = 9, b = 29;
int *p_one;
p_one = &a;
int *p_tow = &b;
cout << "a的值: " << a << endl;
cout << "a的地址: " << &a << endl;
cout << "p_one指向的值: " << *p_one << endl;
cout << "p_one的值: " << p_one << endl;
cout << "p_one的地址: " << &p_one << endl;
cout << "b的值: " << b << endl;
cout << "b的地址: " << &b << endl;
cout << "p_tow指向的值: " << *p_tow << endl;
cout << "p_tow的值: " << p_tow << endl;
cout << "p_tow的地址: " << &p_tow << endl;
system("pause");
return 0;
}

代码助你快速理解C++指针
博客旨在帮助读者快速理解C++指针,通过代码的方式进行讲解,聚焦于信息技术领域中C++编程里指针这一关键知识点。
1119

被折叠的 条评论
为什么被折叠?



