For example, for the following code, I know that p
is a pointer, which points to the first element of the array arr
, and I also know that the array will degenerate into an array under certain conditions, but why can the []
operation be performed on the pointer here?
#include<iostream>
using namespace std;
int main()
{
int arr[10];
arr[3] = 10;
int* p = arr;
cout << p[3];
return 0;
}
Is there any documentation for this?
run it online