void TestPtrArray3(void)
{
char **ppstr;
#define STATIC
#ifdef STATIC
char *strings[] = {"First", "Second", "Third", "Fourth"};
#else
char *s[] = {"First", "Second", "Third", "Fourth"};
char *strings[4];
int i;
for (i = 0; i < 4; i++)
{
strings[i] = malloc(strlen(s[i]) + 1);
strcpy(strings[i], s[i]);
}
#endif
ppstr = strings;
printf("%c\n", **ppstr); /* a character, 'F' */
printf("%s\n", *ppstr); /* a string, "First" */
printf("%c\n", *ppstr[0]); /* a character, 'F' */
printf("%s\n", &**ppstr); /* a string, "First" */
++*ppstr; /* indirect, inc contents (pointer) */
printf("%c\n", **ppstr); /* a character, 'i' */
printf("%s\n", *ppstr); /* a string, "irst" */
(*++ppstr)++; /* inc ppstr (pointer), indirect, inc contents (pointer) */
(*ppstr)++; /* indirect, inc contents (pointer) */
printf("%c\n", **ppstr); /* a character, 'c' */
printf("%s\n", *ppstr); /* a string, "cond" */
ppstr += 2; /* inc ppstr (pointer) by 2 (8) */
*ppstr += 4; /* inc contents of ppstr (pointer) by 4 (16) */
printf("%c\n", **ppstr); /* a character, 't' */
printf("%s\n", *ppstr); /* a string, "th" */
#ifndef STATIC
*++*--ppstr = 'r'; /* ??? */
*(*ppstr += 2) = 'a'; /* ??? */
printf("%s\n", (*ppstr - 3)); /* ??? */
#endif
}