forked from newde/homework
20 lines
537 B
C++
20 lines
537 B
C++
1 #include<iostream>
|
||
2 using namespace std;
|
||
3
|
||
4 int main(){
|
||
5
|
||
6 int a=10;
|
||
7 int b[5]={10,20,30,40,50};
|
||
8 int * ptr_a , * ptr_b;
|
||
9
|
||
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 << "我的地址:"<< ptr_b+i<<endl;
|
||
17
|
||
18 return 0;//这个可以省略
|
||
19
|
||
20 } |