Re: How to increment array of pointers to strings

On Wed, 04 Aug 2010 18:50:50 -0400, Keith Thompson <kst-u@xxxxxxx> wrote:

barncat <thebarncat@xxxxxxxxx> writes:
Thanks. The array is actually a ptr to an array of strings, like:
char *name[] = { "one","two","three" };
which yes, i guess is different than **argv.
sorry, i am just confused trying to learn. I guess i could make it an
** object like argv and work with it that way.

Given the above declaration, name is a pointer to the first element
of an array of char*, where each char* happens to point to (the
first character of) a string. (A pointer to an array is not the same
as a pointer to the array's first element.)

Um, ... no. Given the above declaration, name is not any kind of pointer.
It's an array of (char *).

In most cases, when name appears in an expression it will be *converted*
to a pointer to the first element of the array, but name is most definitely
an array, and not a pointer.

Remember: in spite of several features of C that seem to conspire
to make you think otherwise, arrays are not pointers, and pointers are
not arrays.

Remember: even though in usage they usually get converted to pointers,
arrays are not pointers.
Morris Keesan -- mkeesan@xxxxxxxxxxxxxxxx