Actions

EmSys

C - Pointers and Arrays2

From EdWiki

Pointers and Arrays ...

If pa is a pointer to an integer declared as

int* pa;

Then the assignment

pa = &ar[0];

Sets pa to point to element zero of ar; i.e, pa contains the address of ar[0].

Since the name of an array is a synonym for the location of the initial element, the assignment pa = &ar[0] can also be written as pa = ar.

Now the assignment

x = *pa;

Will copy the contents of ar[0] into x.