指针测试

来源:互联网 发布:mysql 进入数据库 编辑:程序博客网 时间:2024/05/22 12:34
#include<iostream>using namespace std;int main(){int *pInt = NULL;cout << "指针变量pInt地址是:" << &pInt << endl;int pop = 1;cout << "pop地址是:"<< &pop << endl;cout << "pop值是:"<< pop << endl;pInt = &pop;cout << "pInt's value is:"<<pInt<<endl;cout << "pInt's refer value is:"<< *pInt<<endl;int arr_int[2] = { 1,2 };pInt = arr_int;cout << "Address of the first factor of arr_int[0] is: "<< pInt<<endl;cout << "Address of the second factor of arr_int[1] is: "<<pInt + 1<<endl;cout << "Value of the first factor of arr_int[0] is:"<<*pInt<<endl;cout << "Value of the first factor of arr_int[1] is:"<< *pInt + 1<<endl;}


原创粉丝点击