I am working on an exersize where I must display the elements of an initialized array of 10 double elements using a pointer variable and pointer arithmatic, I know how to display one element from the array but how do I display each element from the array?

int a[10] = {0,1,2,3,4,5,6,7,8,9};
int *p = a;
int i;

for ( i = 0; i < 10; i++ )
  printf ( "%d\n", *p++ );
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.