forked from newde/homework
更新 指针/指针和数组的地址.cpp
This commit is contained in:
@@ -5,15 +5,15 @@
|
||||
5
|
||||
6 int a=10;
|
||||
7 int b[5]={10,20,30,40,50};
|
||||
8 int * prt_a , * prt_b;
|
||||
8 int * ptr_a , * ptr_b;
|
||||
9
|
||||
10 prt_a=&a;
|
||||
11 prt_b=b;
|
||||
12 cout << "我是内存地址: "<<prt_a <<" 我是地址内的值 : "<< * prt_a<<endl;
|
||||
13 cout << "我是内存地址: "<<prt_b <<" 我是地址内的值 : "<< * prt_b<<endl;
|
||||
10 ptr_a=&a;
|
||||
11 ptr_b=b;
|
||||
12 cout << "我是内存地址: "<<ptr_a <<" 我是地址内的值 : "<< * ptr_a<<endl;
|
||||
13 cout << "我是内存地址: "<<ptr_b <<" 我是地址内的值 : "<< * ptr_b<<endl;
|
||||
14
|
||||
15 for (int i=0;i<5;i++)
|
||||
16 cout << "我的地址:"<< prt_b+i<<endl;
|
||||
16 cout << "我的地址:"<< ptr_b+i<<endl;
|
||||
17
|
||||
18 return 0;//这个可以省略
|
||||
19
|
||||
|
||||
Reference in New Issue
Block a user