#include<iostream>
using namespace std;
int main()
{
int a = 66666;
int b = 22222;
int c[2] = {333333,44444};
cout << " 修改前的值 " << endl;
cout << " c[2]= " << c[2] << endl;
cout << " c[3]= " << c[3] << endl;
c[3] = 12345; //修改c[3]的值
cout << "修改後的值:" <<endl;
cout << " c[3]= "<< c[3] << endl;
cout << " a= "<< a << endl;
return 0;
}
同理,我們可以利用指針這種東西,如下
#include<iostream>
using namespace std;
int main()
{
int a = 0;
int *p = &a;
for(int i=0;i<10;i++)
{
cout << p << " : ";
cout << *p++ << endl;
}
return 0;
}