指针 数组

来源:互联网 发布:移动网络玩dnf组队卡 编辑:程序博客网 时间:2024/05/18 20:06
#include<iostream>
using namespace std;
int main()
{int a[8]={0,1,2,3,4,5,6,7};
 int *p=a;
 cout<<a<<endl;//输出0012FF60
 cout<<p<<endl;//输出0012FF60
 cout<<*(p+1)<<endl;//输出1;
 cout<<p[2]<<endl;//输出2;
 return 0;
}
 数组与字符数组和指针的关系略有不同;