Originally Posted by
brewbuck
No -- there's really no such thing as a "pointer to an array."
There is such a thing, but it's rarely used, in my experience. C sneaks them in behind your back when you're passing multidimensional arrays to functions:
Code:
void f(int x[][5]);
Here x is actually a pointer to an array of 5 int. This could also be written:
Code:
void f(int (*x)[5]);
You can, of course, also explicitly use pointers to arrays in your code, though I don't ever recall having to do this:
Code:
#include <stdio.h>
int main(void)
{
int a[1] = { 5 };
int (*p)[1] = &a;
printf("%d\n", (*p)[0]);
return 0;
}
Not especially useful, but there you are. If you mentioned that there's really no such thing as pointers to arrays in order to not confuse those new to C, sorry for blowing the operation.