Deal with array pointer of long integer : Array Pointer « Array « C Tutorial






#include <stdio.h>

int main(void)
{
  long multiple[] = {15L, 25L, 35L, 45L};
  long * p = multiple;
  int i;
  for(i = 0 ; i<sizeof(multiple)/sizeof(multiple[0]) ; i++)
    printf("\naddress p+%d (&multiple[%d]): %d   *(p+%d) value: %d", i,i, p+i,i,*(p+i));
  printf("\n    Type long occupies: %d bytes\n", sizeof(long));
  return 0;
}
address p+0 (&multiple[0]): 631656   *(p+0) value: 15
     address p+1 (&multiple[1]): 631660   *(p+1) value: 25
     address p+2 (&multiple[2]): 631664   *(p+2) value: 35
     address p+3 (&multiple[3]): 631668   *(p+3) value: 45
         Type long occupies: 4 bytes








7.8.Array Pointer
7.8.1.The name of an array is the same as &array[ 0 ]
7.8.2.Arrays and pointers: get address of an array
7.8.3.Arrays and pointers: get array value through array pointer
7.8.4.Address of second element in array (value of arraypointer+1)
7.8.5.Move array pointer to the next element
7.8.6.Deal with array pointer of long integer
7.8.7.Accessing an array using pointers