用下标运算符指针运算符访问并输出数组元素
#include<iostream>
using namespace std;
int main()
{
int a[5] = { 1,2,3,4,5 };
int *p = 0;
cout << "下标运算a[i]:" << "\n";
for (int x = 0; x < 5; x++)
{
cout << a[x];
}
cout << "\n指针运算(*p):" << "\n";
for (p = a; p < &a[5]; p++)
{
cout << *p;
}
system("pause");
return 0;
}