This means that subscripts can be used with pointers, as if they were arrays held at the address of the pointer. As C does no array bound checking, this is completely unsafe. You may assign the address of a simple int variable to a pointer to int and than access locations following it as if they belonged to an array of ints, as follows.
void main()
{
int i, * ip;
ip = & i;
ip[0] = 3;
ip[1] = 2;
ip[2] = 1;
}
On the other hand, an array can be used as if it was a pointer. We have
seen that arrays are always passed by reference, even though no & is written,
and this is why. The only
difference is that the address of an array cannot be changed by assignment. Thus,
the following would not be allowed:
void main()
{
int i, ia[];
ia = &i;
}