笔记
作者:互联网
int*型
#include<bits/stdc++.h>
using namespace std;
int main()
{
int val = 5;
int *ptr = &val;
int * &ptr2 = ptr; //ptr2是int* 型,是对str的引用;
*ptr = 6;
cout << val << " " << *ptr <<" "<< *ptr2 << endl;
*ptr2 = 7;
cout << val << " " << *ptr << " " << *ptr2 << endl;
cout << &val << " " << ptr << " " << ptr2 << endl;
delete ptr;
delete ptr2;
}
/*
6 6 6
7 7 7
0x61fe3c 0x61fe3c 0x61fe3c
*/
标签:std,val,int,ptr2,笔记,main,ptr 来源: https://www.cnblogs.com/guaguastandup/p/11446568.html