/* 1203.c: Referencing an array with a pointer */
#include <stdio.h>
main()
{
int *ptr_int;
int list_int[10];
int i;
for (i=0; i<10; i++)
list_int[i] = i + 1;
ptr_int = list_int;
printf( "The start address of the array: 0x%p\n", ptr_int);
printf( "The value of the first element: %d\n", *ptr_int);
ptr_int = &list_int[0];
printf( "The address of the first element: 0x%p\n", ptr_int);
printf( "The value of the first element: %d\n", *ptr_int);
ptr_int = ptr_int + 1;
printf( "The second address of the array: 0x%p\n", ptr_int);
printf( "The value of the second element: %d\n", *ptr_int);
return 0;
}
#include <stdio.h>
main()
{
int *ptr_int;
int list_int[10];
int i;
for (i=0; i<10; i++)
list_int[i] = i + 1;
ptr_int = list_int;
printf( "The start address of the array: 0x%p\n", ptr_int);
printf( "The value of the first element: %d\n", *ptr_int);
ptr_int = &list_int[0];
printf( "The address of the first element: 0x%p\n", ptr_int);
printf( "The value of the first element: %d\n", *ptr_int);
ptr_int = ptr_int + 1;
printf( "The second address of the array: 0x%p\n", ptr_int);
printf( "The value of the second element: %d\n", *ptr_int);
return 0;
}