指针问题求解
#include<iostream>using namespace std;
int main()
{
int a[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, };
int *p = a + 5, *q = NULL;
q = p + 5;
cout << *(p+5) << endl;
cout << *p << " " << *q << endl;
return 0;
}
为什么*q=*(p+5)就报错呢, 和q=p+5区别没搞懂。。求帮解释下