20200104-指针
-
#include "stdafx.h"
-
#include "iostream"
-
#include "cstring"
-
#include "string"
-
using namespace std;
-
int main()
-
{
-
//第一组代码
-
int updates=6;
-
int *pt=&updates;
-
cout<<"pt= "<<pt<<endl;
-
cout<<"*pt= "<<*pt<<endl;
-
*pt+=1;
-
cout<<"加1后*p=t "<<*pt<<endl;
-
cout<<"加1后updates= "<<updates<<endl;
-
//第二组代码
-
int nights=1001;
-
int *pt1=new int;
-
cout<<"*pt1="<<*pt1<<endl;
-
*pt1=1001;
-
cout<<&nights<<endl;
-
cout<<pt1<<endl;
-
-
cout<<sizeof(*pt1)<<endl;
-
double *pt2=new double;
-
*pt2=10.0;
-
-
cout<<sizeof(*pt2)<<endl;
-
cout<<pt2<<endl;
-
}